Beispiel #1
0
 internal void SetInputFeedback(LightwareInput input, string statusModifier)
 {
     if (_input == input && statusModifier != null && _statusModifier == statusModifier)
     {
         return;
     }
     _input = input;
     if (statusModifier != null)
     {
         _statusModifier = statusModifier;
     }
     OnInputChange(this);
 }
Beispiel #2
0
        protected override void SocketOnReceivedData(string args)
        {
            base.SocketOnReceivedData(args);

            var match = Regex.Match(args, @"^\(O(\d{2}) I(\d{2})\)$");

            if (match.Success && int.Parse(match.Groups[1].Value) == Id)
            {
                Debug.WriteSuccess("Output Feedback", "{0} = Input {1}", Id, match.Groups[2].Value);

                var inputIndex = int.Parse(match.Groups[2].Value);

                _input = inputIndex > 0 ? Matrix.Inputs[inputIndex] : null;
                OnInputChange(this);
                return;
            }

            match = Regex.Match(args, @"^\((\d)LO(\d{2})\)$");

            if (match.Success && int.Parse(match.Groups[2].Value) == Id)
            {
                var status = int.Parse(match.Groups[1].Value);

                if (status == 1 && _statusModifier == "M")
                {
                    _statusModifier = "U";
                }
                else if (status == 1)
                {
                    _statusModifier = "L";
                }
                else if (status == 0 && _statusModifier == "U")
                {
                    _statusModifier = "M";
                }
                else
                {
                    _statusModifier = string.Empty;
                }

                OnInputChange(this);
            }
        }