Beispiel #1
0
        public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
        {
            Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType);

            var input  = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
            var output = Convert.ToUInt32(outputSelector);
            // Check to see if there's an off timer waiting on this and if so, cancel
            var key = new PortNumberType(output, sigType);

            if (input == 0)
            {
                StartOffTimer(key);
            }
            else
            {
                if (RouteOffTimers.ContainsKey(key))
                {
                    Debug.Console(2, this, "{0} cancelling route off due to new source", output);
                    RouteOffTimers[key].Stop();
                    RouteOffTimers.Remove(key);
                }
            }



            var inCard  = input == 0 ? null : Chassis.Inputs[input];
            var outCard = input == 0 ? null : Chassis.Outputs[output];

            // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
            if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
            {
                Chassis.VideoEnter.BoolValue     = true;
                Chassis.Outputs[output].VideoOut = inCard;
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="pnt"></param>
 void StartOffTimer(PortNumberType pnt)
 {
     if (RouteOffTimers.ContainsKey(pnt))
     {
         return;
     }
     RouteOffTimers[pnt] = new CTimer(o => { ExecuteSwitch(0, pnt.Number, pnt.Type); }, RouteOffTime);
 }
Beispiel #3
0
        public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
        {
            try
            {
                Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);

                var input  = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
                var output = Convert.ToUInt32(outputSelector);

                if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs)
                {
                    // Check to see if there's an off timer waiting on this and if so, cancel
                    var key = new PortNumberType(output, sigType);
                    if (input == 0)
                    {
                        StartOffTimer(key);
                    }
                    else if (key.Number > 0)
                    {
                        if (RouteOffTimers.ContainsKey(key))
                        {
                            Debug.Console(2, this, "{0} cancelling route off due to new source", output);
                            RouteOffTimers[key].Stop();
                            RouteOffTimers.Remove(key);
                        }
                    }

                    DMInput  inCard  = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
                    DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;

                    //if (inCard != null)
                    //{
                    // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
                    if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
                    {
                        //SystemControl.VideoEnter.BoolValue = true;
                        if (outCard != null)
                        {
                            outCard.VideoOut = inCard;
                        }
                    }

                    if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
                    {
                        if (outCard != null)
                        {
                            outCard.AudioOut = inCard;
                        }
                    }

                    if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
                    {
                        if (outCard != null)
                        {
                            outCard.USBRoutedTo = inCard;
                        }
                    }

                    if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
                    {
                        if (inCard != null)
                        {
                            inCard.USBRoutedTo = outCard;
                        }
                    }
                    //}
                    //else
                    //{
                    //    Debug.Console(1, this, "Unable to execute route from input {0} to output {1}.  Input card not available", inputSelector, outputSelector);
                    //}
                }
                else
                {
                    Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, outputSelector);
                }
            }
            catch (Exception e)
            {
                Debug.Console(1, this, "Error executing switch: {0}", e);
            }
        }