public override void OnSignalStrengthsChanged(SignalStrength newSignalStrength)
 {
     if (newSignalStrength.IsGsm)
     {
         SignalStrengthChanged?.Invoke(newSignalStrength.GsmSignalStrength);
     }
 }
Example #2
0
        public void PrintDevData()
        {
            double cq = (double)GetContactQuality(Channel_t.CHAN_AF3);

            UnityEngine.Debug.Log("======PrintDevData: battery" + Battery.ToString()
                                  + " signal" + SignalStrength.ToString() + " AF3: " + cq.ToString());
        }
Example #3
0
        internal static string GetSignalStrengthDescription(this SignalStrength value)
        {
            switch (value)
            {
            case SignalStrength.Error:
                return("error");

            case SignalStrength.Strong:
                return("strong");

            case SignalStrength.Unknown:
                return("unknown");

            case SignalStrength.VeryStrong:
                return("very strong");

            case SignalStrength.VeryWeak:
                return("very weak");

            case SignalStrength.Weak:
                return("weak");

            default:
                return("");
            }
        }
        public override void OnD2DSignalStrengthChanged(SignalStrength ss)
        {
            Log.Verbose(TAG, "OnD2DSignalStrengthChanged: signal strength = ");
            if (ss.getLteRsrq() == INVALID)
            {
                Log.Verbose(TAG, "OnD2DSignalStrengthChanged: plane");

                /*if (ss.getLteRsrp() != INVALID)
                 * {
                 *  mPlaneMasterRsrp = ss.getLteRsrp();
                 * }
                 *
                 * if (ss.getLteSignalStrength() != 99)
                 * {
                 *  mPlaneSlaveRsrp = -1 * ss.getLteSignalStrength();
                 * }*/
            }
            else
            {
                Log.Verbose(TAG, "OnD2DSignalStrengthChanged: controller");

                /* if (ss.getLteRsrp() != INVALID)
                 * {
                 *  mControllerMasterRsrp = ss.getLteRsrp();
                 * }
                 * if (ss.getLteSignalStrength() != 99)
                 * {
                 *  mControllerSlaveRsrp = -1 * ss.getLteSignalStrength();
                 * }*/
            }
            mMsgHandler.post(updateSignalStrength);
        }
        private void SignalStrengthHandler(SignalReceiver receiver, SignalEmitter emitter, SignalDataSO signalDataSo, ISignalMessage signalMessage = null)
        {
            SignalStrength strength = GetStrength(receiver, emitter, signalDataSo.SignalRange);

            if (strength == SignalStrength.HEALTHY)
            {
                receiver.ReceiveSignal(strength, signalMessage);
            }
            if (strength == SignalStrength.TOOFAR)
            {
                emitter.SignalFailed();
            }


            if (strength == SignalStrength.DELAYED)
            {
                StartCoroutine(DelayedSignalRecevie(receiver.DelayTime, receiver, strength, signalMessage));
                return;
            }
            if (strength == SignalStrength.WEAK)
            {
                Random chance = new Random();
                if (DMMath.Prob(chance.Next(0, 100)))
                {
                    StartCoroutine(DelayedSignalRecevie(receiver.DelayTime, receiver, strength, signalMessage));
                }
                emitter.SignalFailed();
            }
        }
Example #6
0
        private void change(bool add, int count)
        {
            int value = (int)this.strength;

            if (add) // es soll addiert werden
            {
                value += count;
            }
            else // es soll subtraiert werden
            {
                value -= count;
            }

            if (value < 1)
            {
                value = 1;
            }

            if (value > 5)
            {
                value = 5;
            }
            this.strengthBeforeChange = this.strength;
            this.strength             = (SignalStrength)value;
        }
Example #7
0
 public static int getLteRsrq(this SignalStrength ss)
 {
     if (ss == null)
     {
         return(0);
     }
     return(ss.CdmaDbm);
 }
        public event Action <SignalStrength> SignalStrengthChanged;//No need to declare a delegate
        public override void OnSignalStrengthsChanged(SignalStrength signalStrength)
        {
            base.OnSignalStrengthsChanged(signalStrength);

            Console.WriteLine("signalStrength " + signalStrength);

            SignalStrengthChanged?.Invoke(signalStrength);
        }
Example #9
0
        /**
         * erzeugt ein Signal, dass mit der genannten Zeit
         * @param sTime Zeit in ms
         */
        public Signal(int sTime)
        {
            defaultVariables();

            time = sTime;

            strength = SignalStrength.VERYSTRONG;
            init();
        }
Example #10
0
        private void RadioButtonPassend_Click(object sender, RoutedEventArgs e)
        {
            endTimeStrength = Environment.TickCount;
            RadioButtonPassend.IsChecked = true;
            signalStrength = SignalStrength.OK;
            bStrength      = true;

            afterClick();
        }
Example #11
0
        private void RadioButtonVeryStrong_Click(object sender, RoutedEventArgs e)
        {
            endTimeStrength = Environment.TickCount;
            RadioButtonVeryStrong.IsChecked = true;
            signalStrength = SignalStrength.VERYSTRONG;
            bStrength      = true;

            afterClick();
        }
Example #12
0
 public void setSignalAlgo(SignalTyp signalTyp, SignalRating rating, SignalStrength signalStrength, long timeSignal, long timeRating, long timeStrength, int countReplay)
 {
     signal.setRecognizeType(signalTyp);
     signal.setTimeToRecognizeType(timeSignal);
     signal.setRating(rating);
     signal.setTimeToRecognizeRating(timeRating);
     signal.setRecognizeStrength(signalStrength);
     signal.setTimeToRecognizeStrength(timeStrength);
     signal.setAlgoCountReplay(countReplay);
 }
    private void Update()
    {
        var strength = _mindReader.SignalStrength;

        if (strength != _currentSignalStrength)
        {
            _image.texture         = _textures[(int)strength];
            _currentSignalStrength = strength;
        }
    }
Example #14
0
        /// <summary>
        /// Set the signal info the user sees.
        /// </summary>
        /// <param name="signalStrength">contains all the signal info</param>
        /// <see cref="Android.Telephony.SignalStrength"/>
        private void setSignalInfo(SignalStrength signalStrength)
        {
            Log.Debug(TAG, "formatting sig str");
            var spaceStr = new Regex(" ");

            string[] sigInfo = formatSignalData(spaceStr.Split(signalStrength.ToString()));

            Log.Debug("Signal Array", sigInfo.ToString());
            displaySignalInfo(sigInfo);
        }
Example #15
0
 /// <summary>
 /// Creates a new instance with passed in values for all properties.
 /// </summary>
 /// <param name="player">The value to be used for <see cref="PlayerValue"/>.</param>
 /// <param name="playerSignalStrength">The value to be used for <see cref="PlayerSignalStrength"/>.</param>
 /// <param name="playerUpdated">The value to be used for <see cref="PlayerUpdated"/></param>
 /// <param name="timeOfDeath">The value to be used for <see cref="TimeOfDeath"/></param>
 /// <param name="positionUpdated">The value to be used for <see cref="PositionUpdated"/></param>
 /// <param name="signalStrengtUpdated">The value to be used for <see cref="SignalStrengthUpdated"/></param>
 public PlayerState(IPlayer player, SignalStrength playerSignalStrength, double score, DateTime playerUpdated, DateTime timeOfDeath, DateTime positionUpdated, DateTime signalStrengtUpdated)
 {
     PlayerValue = player;
     PlayerSignalStrength = playerSignalStrength;
     Score = score;
     PlayerUpdated = playerUpdated;
     TimeOfDeath = timeOfDeath;
     PositionUpdated = positionUpdated;
     SignalStrengthUpdated = signalStrengtUpdated;
 }
Example #16
0
 public override void ReceiveSignal(SignalStrength strength)
 {
     if (doorSwitch != null)
     {
         doorSwitch.RunDoorController();
         Respond(Emitter);
         return;
     }
     Emitter.SignalFailed();
 }
Example #17
0
 public override void OnSignalStrengthsChanged(SignalStrength newSignalStrength)
 {
     if (newSignalStrength.IsGsm)
     {
         if (SignalStrengthChanged != null)
         {
             SignalStrengthChanged(newSignalStrength.GsmSignalStrength);
         }
     }
 }
Example #18
0
            /// <summary>
            /// Get the Signal strength from the provider, each time there is an update
            /// </summary>
            /// <param name="signalStrength">has all the useful signal stuff in it.</param>
            public override void OnSignalStrengthsChanged(SignalStrength signalStrength)
            {
                base.OnSignalStrengthsChanged(signalStrength);

                if (signalStrength != null)
                {
                    si.setSignalInfo(signalStrength);
                    Log.Debug(TAG, "getting sig strength");
                    Log.Debug(TAG, signalStrength.ToString());
                }
            }
Example #19
0
        /**
         * Konstruktor des Signals
         * @param sType Signaltyp
         * @param sTime Zeit in ms, die sich in dem Intervall des Signaltyps befinden soll
         */
        public Signal(SignalTyp sType, int sTime, SignalStrength sStrength)
        {
            // alle Variablen initialisieren
            defaultVariables();

            // setzen der Variablen
            this.type     = sType;
            this.time     = sTime;
            this.strength = sStrength;
            //cSignalCode = new char [(end/5)];
            init();
        }
Example #20
0
        /**
         * Dieser Konstruktor ist extra fuer den letzten Schritt (erkennungs Page gedacht)
         **/
        public Signal(SignalTyp type, int sTime, SignalStrength strength, int begin, int end)
        {
            defaultVariables();

            // setzen der Variablen
            this.type     = type;
            this.time     = sTime;
            this.strength = strength;
            this.begin    = begin;
            this.end      = end;

            // init beinhaltet noch eine right Time Methode die ich nicht benoetige daher die einzelnen Aufrufe.
            calculate();
            createString();
        }
Example #21
0
        /// <summary>
        /// Returns true if a mapping is found for <see cref="SignalStrength"/> <paramref name="signalStrength"/> to a
        /// <see cref="Sprite"/>, otherwise false.
        /// </summary>
        /// <param name="signalStrength"></param>
        /// <param name="sprite"></param>
        /// <returns></returns>
        public bool TryGetIcon(SignalStrength signalStrength, out Sprite sprite)
        {
            sprite = null;

            IconMapping iconMapping;

            if (!iconMappingLookup.TryGetValue(signalStrength, out iconMapping))
            {
                Debug.LogWarningFormat(this, MappingMissingWarningFormat, signalStrength);
                return(false);
            }

            sprite = iconMapping.sprite;

            return(true);
        }
        /// <summary>
        /// Returns true if a mapping is found for <see cref="SignalStrength"/> <paramref name="signalStrength"/> to a
        /// <see cref="Sprite"/>, otherwise false.
        /// </summary>
        /// <param name="signalStrength"></param>
        /// <param name="sprite"></param>
        /// <returns></returns>
        public bool TryGetIcon(SignalStrength signalStrength, out Sprite sprite)
        {
            sprite = null;

            IconMapping iconMapping;

            if (!_iconMappingLookup.TryGetValue(signalStrength, out iconMapping))
            {
                Debug.LogWarningFormat(this, MAPPING_MISSING_WARNING_FORMAT, signalStrength);
                return(false);
            }

            sprite = iconMapping.sprite;

            return(true);
        }
Example #23
0
 private void setVariablesDefault()
 {
     untypedSignal    = SignalTyp.NODATA;
     signalRating     = SignalRating.NODATA;
     signalStrength   = SignalStrength.NODATA;
     bType            = false;
     bRating          = false;
     bStrength        = false;
     startTime        = Environment.TickCount;
     endTimeSignal    = -1;
     endTimeRating    = -1;
     endTimeStrength  = -1;
     diffTimeSignal   = -1;
     diffTimeRating   = -1;
     diffTimeStrength = -1;
     countReplay      = 0;
 }
Example #24
0
 protected virtual void SetSignalStrength(int signalStrength)
 {
     if (signalStrength > 107)
     {
         _signalStrengthLevel = SignalStrength.NoSignal;
     }
     else if (signalStrength >= 78 && signalStrength < 107)
     {
         _signalStrengthLevel = SignalStrength.WeakSignal;
     }
     else if (signalStrength >= 51 && signalStrength < 78)
     {
         _signalStrengthLevel = SignalStrength.MediocreSignal;
     }
     else
     {
         _signalStrengthLevel = SignalStrength.GoodSignal;
     }
 }
Example #25
0
        /**
         * initialisiert alle Werte
         */
        private void defaultVariables()
        {
            type     = SignalTyp.NODATA;
            strength = SignalStrength.NODATA;

            recognizeType     = SignalTyp.NODATA;
            rating            = SignalRating.NODATA;
            recognizeStrength = SignalStrength.NODATA;
            time                    = -1;
            signalCode              = "empty";
            iNull                   = -1;
            iEins                   = -1;
            begin                   = -1;
            end                     = -1;
            timeToRecognizeType     = -1;
            timeToRecognizeRating   = -1;
            timeToRecognizeStrength = -1;

            replayCountInitSignalPage = -1;
            replayCountAlgoPage       = -1;
        }
Example #26
0
        private Object createAndInsertDataWithContent(JObject identiferObj, String data, Entry entry)
        {
            Object dataObj = null;
            //Decode base 64 encoded data.
            String jsonDataString = base64Decode(data);

            String objectIdentifier = (String)identiferObj["uniqueID"];

            switch (objectIdentifier)
            {
            case "aethers.notebook.logger.managed.celllocation.CellLocationLogger":
                CellLocation cellLocation = createCellLocation(jsonDataString, entry);
                dataObj = cellLocation;
                break;

            case "aethers.notebook.logger.managed.dataconnectionstate.DataConnectionStateLogger":
                DataConnection dataConnection = createDataConnection(jsonDataString, entry);
                dataObj = dataConnection;
                break;

            case "aethers.notebook.logger.managed.servicestate.ServiceStateLogger":
                ServiceState serviceState = createServiceState(jsonDataString, entry);
                dataObj = serviceState;
                break;

            case "aethers.notebook.logger.managed.signalstrength.SignalStrengthLogger":
                SignalStrength signalStrength = createSignalStrength(jsonDataString, entry);
                dataObj = signalStrength;
                break;

            case "aethers.notebook.logger.managed.wifi.WifiLogger":
                List <Wifi> wifiPoints = createWifiPoints(jsonDataString, entry);
                dataObj = wifiPoints;
                break;
            }

            return(dataObj);
        }
Example #27
0
        private SignalStrength createSignalStrength(String jsonDataString, Entry entry)
        {
            JObject jsonDataObj = JObject.Parse(jsonDataString);

            /*
             * SignalStrength signalStrength = JsonConvert.DeserializeObject<SignalStrength>(jsonDataObj.ToString());
             * //insert signal strength.
             * entry.SignalStrengths.Add(signalStrength);
             * return signalStrength;*/

            SignalStrength signalStrength = new SignalStrength();

            signalStrength.cdmaDbm           = (int)jsonDataObj["cdmaDbm"];
            signalStrength.cdmaEcio          = (int)jsonDataObj["cdmaEcio"];
            signalStrength.evdoDbm           = (int)jsonDataObj["evdoDbm"];
            signalStrength.evdoEcio          = (int)jsonDataObj["evdoEcio"];
            signalStrength.evdoSnr           = (int)jsonDataObj["evdoSnr"];
            signalStrength.gsmBitErrorRate   = (int)jsonDataObj["gsmBitErrorRate"];
            signalStrength.gsmSingalStrength = (int)jsonDataObj["gsmSignalStrength"];
            signalStrength.isGsm             = (Boolean)jsonDataObj["isGsm"];
            //insert service state
            entry.SignalStrengths.Add(signalStrength);
            return(signalStrength);
        }
Example #28
0
 /// <summary>
 /// Creates a MockWifiStrengthMonitor with a static <see cref="SignalStrength"/>.
 /// </summary>
 /// <param name="value">The strength of the wireless signal this mock object will hold.</param>
 public MockWifiStrengthMonitor(double value)
 {
     Strength = new SignalStrength(value);
 }
 public override int GetHashCode()
 {
     return(DeviceAddress.GetHashCode() ^ IsInNetwork.GetHashCode() ^ Capabilities.GetHashCode() ^ Roles.GetHashCode() ^ SignalStrength.GetHashCode() ^
            BatteryStatus.GetHashCode() ^ IsAligned.GetHashCode() ^ ClockSynchronization.GetHashCode() ^ HasVersionMismatch.GetHashCode());
 }
Example #30
0
 /// <summary>
 /// Returns a new instance which is the same as this instance, except with a different <see cref="PlayerSignalStrength"/>
 /// and the <see cref="SignalStrengthUpdated"/> set to the current time.
 /// </summary>
 /// <param name="signalStrength">The new <see cref="SignalStrength"/> to be used.</param>
 /// <returns></returns>
 public PlayerState UpdateSignalStrength(SignalStrength signalStrength)
 {
     return new PlayerState(PlayerValue, signalStrength, Score, PlayerUpdated, TimeOfDeath, PositionUpdated, DateTime.UtcNow);
 }
Example #31
0
        private SignalStrength createSignalStrength(String jsonDataString, Entry entry)
        {
            JObject jsonDataObj = JObject.Parse(jsonDataString);
            /*
            SignalStrength signalStrength = JsonConvert.DeserializeObject<SignalStrength>(jsonDataObj.ToString());
            //insert signal strength.
            entry.SignalStrengths.Add(signalStrength);
            return signalStrength;*/

            SignalStrength signalStrength = new SignalStrength();
            signalStrength.cdmaDbm = (int)jsonDataObj["cdmaDbm"];
            signalStrength.cdmaEcio = (int)jsonDataObj["cdmaEcio"];
            signalStrength.evdoDbm = (int)jsonDataObj["evdoDbm"];
            signalStrength.evdoEcio = (int)jsonDataObj["evdoEcio"];
            signalStrength.evdoSnr = (int)jsonDataObj["evdoSnr"];
            signalStrength.gsmBitErrorRate = (int)jsonDataObj["gsmBitErrorRate"];
            signalStrength.gsmSingalStrength = (int)jsonDataObj["gsmSignalStrength"];
            signalStrength.isGsm = (Boolean)jsonDataObj["isGsm"];
            //insert service state
            entry.SignalStrengths.Add(signalStrength);
            return signalStrength;
        }
Example #32
0
 /// <summary>
 /// Logic to do when
 /// </summary>
 public abstract void ReceiveSignal(SignalStrength strength, ISignalMessage message = null);
        private IEnumerator DelayedSignalRecevie(float waitTime, SignalReceiver receiver, SignalStrength strength, ISignalMessage signalMessage = null)
        {
            yield return(WaitFor.Seconds(waitTime));

            if (receiver.gameObject == null)
            {
                //In case the object despawns before the signal reaches it
                yield break;
            }
            receiver.ReceiveSignal(strength, signalMessage);
        }
Example #34
0
 public Hero3Camera SignalStrength(out SignalStrength signalStrength)
 {
     signalStrength = base.BacpacStatus().Rssi;
     return(this);
 }