コード例 #1
0
 void OnInputPinProbeData(InputPin origin, string request)
 {
     if (origin.GetType().Name == _inputPinName && InputPinData != null)
     {
         InputPinData(origin, request);
     }
 }
コード例 #2
0
        public DynamicAdder(int bits)
        {
            fullAdders = new FullAdder[bits];
            var inputPinSeriesA    = new InputPin[bits];
            var inputPinSeriesB    = new InputPin[bits];
            var outputPinSeriesSum = new OutputPin[bits];

            FullAdder previousFullAdder = null;

            for (var i = 0; i < bits; i++)
            {
                var fullAdder = new FullAdder();

                if (previousFullAdder != null)
                {
                    previousFullAdder.CarryOver.ConnectTo(fullAdder.CarryIn);
                }

                fullAdders[i]         = fullAdder;
                inputPinSeriesA[i]    = fullAdder.InputA;
                inputPinSeriesB[i]    = fullAdder.InputB;
                outputPinSeriesSum[i] = fullAdder.Sum;

                previousFullAdder = fullAdder;
            }

            Overflow = previousFullAdder.CarryOver;

            InputA = new InputPinSeries(inputPinSeriesA);
            InputB = new InputPinSeries(inputPinSeriesB);
            Sum    = new OutputPinSeries(outputPinSeriesSum);
        }
コード例 #3
0
 void OnInputPinProbeData(InputPin origin, string request)
 {
     if (origin.GetType().Name == _inputPinName && InputPinData != null)
     {
         InputPinData(origin, request);
     }
 }
コード例 #4
0
        private void Simulator_MouseClick(object sender, MouseEventArgs e)
        {
            if (Simulating)
            {
                InputPin ip = Scene.InputClicked(e.Location);
                if (ip != null)
                {
                    ip.Toggle();
                }
            }


            if (e.Button == MouseButtons.Right)
            {
                if (CurrentMouseState == MouseState.Default)
                {
                    ClickedPosition = e.Location;
                    cmsMainMenu.Show(Cursor.Position);
                }
                else if (CurrentMouseState == MouseState.Wire)
                {
                    WireBuilder.Dismiss();
                    CurrentMouseState = MouseState.Default;
                }
            }
            Invalidate(true);
        }
コード例 #5
0
ファイル: BitCombiner.cs プロジェクト: shilrobot/bangaio
 public BitCombiner(int bufferSize)
 {
     if ((bufferSize & 1) != 0)
         throw new ArgumentException("BufferSize must be divisible by two", "bufferSize");
     Input = new InputPin<float>(bufferSize);
     Input.BufferFilled += new InputPin<float>.BufferFilledHandler(Input_BufferFilled);
 }
コード例 #6
0
        public WinFormsRenderer()
        {
            _nameProperty = new Property("Name", FilterPropertyType.String)
            {
                Value = "Image"
            };
            AddProperty(_nameProperty);

            _sizeProperty = new PointProperty("Size", FilterPropertyType.Size)
            {
                Value = new Size(400, 300)
            };
            AddProperty(_sizeProperty);

            _locationProperty = new PointProperty("Point", FilterPropertyType.Point)
            {
                Value = Point.Empty
            };
            AddProperty(_locationProperty);

            _borderStyleProperty = new EnumProperty("Border", FilterPropertyType.Enum, Enum.GetNames(typeof(FormBorderStyle)))
            {
                Value = FormBorderStyle.Sizable.ToString()
            };
            AddProperty(_borderStyleProperty);

            _zoomProperty = new IntegerProperty("Zoom", 5, 1000, 5)
            {
                Value = 100
            };
            AddProperty(_zoomProperty);

            _inputPin = new InputPin("Image", PinMediaType.Image);
            AddPin(_inputPin);
        }
コード例 #7
0
 public ConvertToHsv()
 {
     _input = new InputPin("Input", PinMediaType.Image);
     AddPin(_input);
     _output = new OutputPin("HSV", PinMediaType.Image);
     AddPin(_output);
 }
コード例 #8
0
        /// <summary>
        /// Beendet die Nutzung dieser Instanz endgültig.
        /// </summary>
        public override void Dispose()
        {
            // Stop and raw TS dump
            StopDump();

            // Stop all
            Stop();

            // Forward to injectors
            using (Injector ts = m_TSInjector)
                if (ts != null)
                {
                    // Forget
                    m_TSInjector = null;

                    // Shut down
                    ts.Inject(null, 0, 0, true, null);
                }

            // Clear AV
            SetAudioType(null);
            SetVideoType(null);

            // Forward to input pin
            using (var pin = m_Pin)
                m_Pin = null;

            // Forget the graph
            BDAEnvironment.Release(ref m_Graph);

            // Forward
            base.Dispose();
        }
コード例 #9
0
        //the input has changed - if this mean's we have triggerd then pass this through the event handler
        //if there is a delay setup then the trigger won't happen till the time is up
        protected override void InputChangedEventHandler(InputPin pin)
        {
            Log.LogMessage("InputChangedEventHandler " + pin.Name + " Value: " + pin.Value);
            //log.LogDebugMessage("TriggeredEventHandler " + (TriggeredEventHandler != null).ToString());
            if (IsTriggered())
            {
                Log.LogMessage(pin.Name + " triggered on " + TriggerState);

                //don't try and start the timer if it's already running
                if (MsDelay > 0 && !_delayTimer.Enabled)
                {
                    Log.LogMessage("Starting delay trigger on " + pin.Name + " for " + MsDelay + "ms");

                    _delayTimer.Start();
                }
                else
                {
                    InvokeTriggeredEventHandler();
                }
            }
            //if we have gone into a non-trigger state, stop any delay timer if wanted
            else if (ResetDelayIfInputChanges)
            {
                _delayTimer.Stop();
            }
        }
コード例 #10
0
 protected Gate2Input(string name = null)
     : base(name)
 {
     InputB = new InputPin(this, "InputB");
     InputB.StateChanged += OnInputChanged;
     InputB.Connected    += OnInputChanged;
 }
コード例 #11
0
 public double GetInputDifference(double vRef, InputPin positiveInputPin, InputPin negativeInputPin)
 {
     return(GetInput(
                vRef,
                GetPositiveInputMuxValue(positiveInputPin),
                GetNegativeInputMuxValue(negativeInputPin)));
 }
コード例 #12
0
        public void HandleCircuitChange(bool state, InputPin inputPin)
        {
            LogHelper.LogMessage("state: {0}, inputPin: {1}", state, inputPin);

            var circuit = _mapper.MapInputPinToCircuit(inputPin);

            if (state)
            {
                //when circuit is turned on
                var newRow = new CircuitStateHistoryEntity
                {
                    Circuit        = circuit,
                    TurnOnTime     = _dateProvider.GetUtcDateTimeDate(),
                    TurnedOnLength = 0
                };
                _circuitsDalHelper.InsertHistory(newRow);
            }
            else
            {
                var turnedOnEntry = _circuitsDalHelper.GetLastRowHistoricalState(circuit);
                if (turnedOnEntry != null)
                {
                    var now          = _dateProvider.GetUtcDateTimeDate();
                    var turnedOnTime = (int)Math.Round((now - turnedOnEntry.TurnOnTime).TotalSeconds);
                    turnedOnEntry.TurnedOnLength = turnedOnTime;

                    _circuitsDalHelper.UpdateHistory(turnedOnEntry);
                }
            }

            _circuitsDalHelper.UpdateCircuitState(circuit, state);
            _eventBroadcaster.BroadcastCircuitStateChange(new StateChange {
                Circuit = circuit, State = state
            });
        }
コード例 #13
0
        private static byte GetNegativeInputMuxValue(InputPin inputPin)
        {
            switch (inputPin)
            {
            case InputPin.AD0:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn0);

            case InputPin.AD1:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn1);

            case InputPin.AD2:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn2);

            case InputPin.AD3:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn3);

            case InputPin.AD4:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn4);

            case InputPin.AD5:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn5);

            case InputPin.AD6:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn6);

            case InputPin.AD7:
                return(Constants.MuxValue.NegativeInputChannel_AnalogIn7);

            default:
                throw new ArgumentOutOfRangeException(nameof(inputPin), inputPin, null);
            }
        }
コード例 #14
0
 public double GetInput(double vRef, InputPin inputPin)
 {
     return(GetInput(
                vRef,
                GetPositiveInputMuxValue(inputPin),
                Constants.MuxValue.NegativeInputChannel_AnalogInCom));
 }
コード例 #15
0
 private void RaiseInputPinDataEvent(InputPin origin, string request)
 {
     if (InputPinProbeData != null)
     {
         InputPinProbeData(origin, request);
     }
 }
コード例 #16
0
        public void StartSingleInputPin(string inputPinName, string inputPinCfgData)
        {
            _inputPins  = new Dictionary <string, InputPin>();
            _outputPins = new Dictionary <string, OutputPin>();

            try
            {
                if (!_inputPins.ContainsKey(inputPinName))
                {
                    InputPin pin = Pin.CreatePin(this, inputPinName, inputPinCfgData)
                                   as InputPin;
                    _inputPins.Add(inputPinName + inputPinCfgData, pin);
                }
                else
                {
                    Logger.LogInfo("Input pin: {0} is already configured with same settings: {1}. Skipping ...",
                                   inputPinName, inputPinCfgData);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Input pin: {0} could not start up: {1}",
                                                             inputPinName, ex.Message));
            }
        }
コード例 #17
0
        public Not()
        {
            _input = new InputPin("Input", PinMediaType.Image);
            AddPin(_input);

            _output = new OutputPin("Not", PinMediaType.Image);
            AddPin(_output);
        }
コード例 #18
0
 public override void _Process(float delta)
 {
     if (LastInputPinPressed != null && LastOutputPinPressed != null)
     {
         LastInputPinPressed.ConnectedPin = LastOutputPinPressed;
         LastInputPinPressed  = null;
         LastOutputPinPressed = null;
     }
 }
コード例 #19
0
        //the input has changed - if this mean's we have triggerd then pass this through the event handler
        protected virtual void InputChangedEventHandler(InputPin pin)
        {
            if (TriggeredEventHandler != null && IsTriggered())
            {
                Log.LogMessage(pin.Name + " triggered on " + TriggerState);

                TriggeredEventHandler.Invoke();
            }
        }
コード例 #20
0
        public MSER()
        {
            var mserDetector = new MSERDetector();

            _deltaProperty = new IntegerProperty("Delta", 1, 100, 1)
            {
                Value = mserDetector.Delta
            };
            _maxAreaProperty = new IntegerProperty("MaxArea", 10, 288000, 250)
            {
                Value = mserDetector.MaxArea
            };
            _minAreaProperty = new IntegerProperty("MinArea", 1, 16000, 100)
            {
                Value = mserDetector.MinArea
            };
            _maxVariationProperty = new FloatProperty("MaxVariation", 0, 1, (decimal)0.01f, 2)
            {
                Value = mserDetector.MaxVariation
            };
            _minDiversityProperty = new FloatProperty("MinDiversity", 0, 1, (decimal)0.01f, 2)
            {
                Value = mserDetector.MinDiversity
            };
            _maxEvolutionProperty = new IntegerProperty("MaxEvolution", 0, 1000, 1)
            {
                Value = mserDetector.MaxEvolution
            };
            _areaThresholdProperty = new FloatProperty("AreaThreshold", 0, 5, (decimal)0.01f, 2)
            {
                Value = (float)mserDetector.AreaThreshold
            };
            _minMarginProperty = new FloatProperty("MinMargin", 0, 1, (decimal)0.001f, 3)
            {
                Value = (float)mserDetector.MinMargin
            };
            _edgeBlurSizeProperty = new IntegerProperty("EdgeBlurSize", 0, 100, 1)
            {
                Value = mserDetector.EdgeBlurSize
            };
            AddProperty(_deltaProperty);
            AddProperty(_maxAreaProperty);
            AddProperty(_minAreaProperty);
            AddProperty(_maxVariationProperty);
            AddProperty(_minDiversityProperty);
            AddProperty(_maxEvolutionProperty);
            AddProperty(_areaThresholdProperty);
            AddProperty(_minMarginProperty);
            AddProperty(_edgeBlurSizeProperty);

            _input  = new InputPin("Image", PinMediaType.Image);
            _output = new OutputPin("Contours", PinMediaType.ContoursArray);
            AddPin(_input);
            AddPin(_output);
        }
コード例 #21
0
        public DestFileImage()
        {
            _filepathProperty = new Property("FilePath", FilterPropertyType.String)
            {
                Value = "filename.png"
            };
            AddProperty(_filepathProperty);

            _inputPin = new InputPin("Image", PinMediaType.Image);
            AddPin(_inputPin);
        }
コード例 #22
0
 public SplitRgb()
 {
     _input   = new InputPin("Input", PinMediaType.Image);
     _outputB = new OutputPin("B", PinMediaType.Image);
     _outputG = new OutputPin("G", PinMediaType.Image);
     _outputR = new OutputPin("R", PinMediaType.Image);
     AddPin(_input);
     AddPin(_outputR);
     AddPin(_outputG);
     AddPin(_outputB);
 }
コード例 #23
0
 public Merge()
 {
     _output = new OutputPin("Output", PinMediaType.Image);
     _inputB = new InputPin("B", PinMediaType.Image);
     _inputG = new InputPin("G", PinMediaType.Image);
     _inputR = new InputPin("R", PinMediaType.Image);
     AddPin(_output);
     AddPin(_inputR);
     AddPin(_inputG);
     AddPin(_inputB);
 }
コード例 #24
0
ファイル: Clone.cs プロジェクト: kholodovitch/opencv-graph
        public Clone()
        {
            _countProperty = new IntegerProperty("Count of copies", 0, 10, 1);
            _countProperty.OnValueChanged += OnChangedCountOfCopies;
            AddProperty(_countProperty);

            _input = new InputPin("Input", PinMediaType.Image);
            AddPin(_input);
            _originalOutput = new OutputPin("Original", PinMediaType.Image);
            AddPin(_originalOutput);
        }
コード例 #25
0
        /// <summary>
        /// Erzeugt einen neuen Filter.
        /// </summary>
        /// <param name="graph">Optional für den Fall, dass der Filter als
        /// Datenstromquelle genutzt wird.</param>
        public TSFilter(DisplayGraph graph)
        {
            // Remember
            DisplayGraph = graph;

            // Create pin helper
            m_Pin = new InputPin(this, false);

            // Create injectors
            m_TSInjector = new Injector(50, 512 * TS.Manager.FullSize, m_Pin.Receive);
        }
コード例 #26
0
ファイル: SplitHSV.cs プロジェクト: kholodovitch/opencv-graph
 public SplitHsv()
 {
     _input   = new InputPin("Input", PinMediaType.Image);
     _outputH = new OutputPin("H", PinMediaType.Image);
     _outputS = new OutputPin("S", PinMediaType.Image);
     _outputV = new OutputPin("V", PinMediaType.Image);
     AddPin(_input);
     AddPin(_outputH);
     AddPin(_outputS);
     AddPin(_outputV);
 }
コード例 #27
0
ファイル: Or.cs プロジェクト: kholodovitch/opencv-graph
        public Or()
        {
            _input0 = new InputPin("Input 0", PinMediaType.Image);
            AddPin(_input0);

            _input1 = new InputPin("Input 1", PinMediaType.Image);
            AddPin(_input1);

            _output = new OutputPin("Or", PinMediaType.Image);
            AddPin(_output);
        }
コード例 #28
0
        public FastNlMeansDenoisingColored()
        {
            _areaSizeProperty = new IntegerProperty("Area size", 0, 10, 1);
            AddProperty(_areaSizeProperty);

            _input = new InputPin("Input 0", PinMediaType.Image);
            AddPin(_input);

            _output = new OutputPin("And", PinMediaType.Image);
            AddPin(_output);
        }
コード例 #29
0
        private ConnectorPin MapInputPin(InputPin inputPin)
        {
            var pin = _inputPins.SingleOrDefault(ip => ip.Item1 == inputPin);

            if (pin == null)
            {
                var errMsg = string.Format("Invalid value: {0}", inputPin);
                throw new ArgumentOutOfRangeException(errMsg);
            }

            return(pin.Item2);
        }
コード例 #30
0
ファイル: InRange.cs プロジェクト: kholodovitch/opencv-graph
        public InRange()
        {
            _minProperty = new IntegerProperty("Min value", 0, 255, 1);
            AddProperty(_minProperty);
            _maxProperty = new IntegerProperty("Max value", 0, 255, 1);
            AddProperty(_maxProperty);

            _input = new InputPin("Input", PinMediaType.Image);
            AddPin(_input);

            _output = new OutputPin("Filtered", PinMediaType.Image);
            AddPin(_output);
        }
コード例 #31
0
        static void Main(string[] args)
        {
            var Pin = new InputPin(62, AutoClient.Libs.IO.DTO.PinParameters.EdgeEvent.both);

            Pin.PinEvent += Pin_PinEvent;
            //var name = "Name1";
            //var login = "******";
            //var pass = "******";
            //var host = "192.168.0.102";
            //var port = 12321;

            //UnityContainer container = new UnityContainer();
            //ContainerConfigurator.Configure(container, name);

            //var Client = container.Resolve<IClient>();

            //Client.Configure(host, port, login, pass);
            //Client.Start();
        }
コード例 #32
0
        public Circuit MapInputPinToCircuit(InputPin inputPin)
        {
            switch (inputPin)
            {
            case InputPin.I1:
                return(Circuit.C1);

            case InputPin.I2:
                return(Circuit.C2);

            case InputPin.I3:
                return(Circuit.C3);

            case InputPin.I4:
                return(Circuit.C4);

            case InputPin.I5:
                return(Circuit.C5);

            case InputPin.I6:
                return(Circuit.C6);

            case InputPin.I7:
                return(Circuit.C7);

            case InputPin.I8:
                return(Circuit.C8);

            case InputPin.I9:
                return(Circuit.C9);

            case InputPin.I10:
                return(Circuit.C10);

            default:
                throw new ArgumentOutOfRangeException(nameof(inputPin));
            }
        }
コード例 #33
0
ファイル: RecordForm.cs プロジェクト: shilrobot/bangaio
        private void StartRecording()
        {
            if (recording)
                return;
            Guid guid = ((DeviceItem)deviceCombo.SelectedItem).DeviceInformation.DriverGuid;

            const int Fs = 44100;

            powerMeter = new PowerMeter(Util.CalcBufferSize(0.1f, Fs));
            powerMeter.PowerUpdated += new PowerMeter.PowerUpdatedHandler(powerMeter_PowerUpdated);

            waveCap = new WaveCapture(guid, Fs, 32 * 1024, 50);
            frontEnd = new FrontEnd(Fs, 1022.76);
            UnitOffset<float> offset = new UnitOffset<float>();
            BitCombiner combiner1 = new BitCombiner();
            BitCombiner combiner2 = new BitCombiner();
            decider1 = new Decider(1);
            decider2 = new Decider(2);
            FirstOneWins<bool> firstOneWins = new FirstOneWins<bool>();
            ConvertToBytes convertToBytes = new ConvertToBytes();
            Progress progress = new Progress();

            // set up capture outputs
            waveCap.Output.Connect(frontEnd.Input);
            waveCap.Output.Connect(powerMeter.Input);

            // set up front-end outputs
            InputPin<float> phasePin = new InputPin<float>();
            frontEnd.PhaseOutput.Connect(phasePin);
            phasePin.BufferFilled += new InputPin<float>.BufferFilledHandler(PhaseOutputBuffer_BufferFilled);
            frontEnd.EyeOutput.Connect(eyePlot1.Input);
            frontEnd.Output.Connect(combiner1.Input);
            frontEnd.Output.Connect(offset.Input);
            offset.Output.Connect(combiner2.Input);

            // Set up combiner outputs
            combiner1.Output.Connect(decider1.Input);
            combiner2.Output.Connect(decider2.Input);

            // Set up decider outputs
            decider1.Output.Connect(firstOneWins.Input1);
            decider2.Output.Connect(firstOneWins.Input2);

            firstOneWins.Output.Connect(convertToBytes.Input);

            convertToBytes.Output.Connect(progress.Input);

            // TODO: Look into reset signal crap...

            phasePlot2.Clear();
            phasePlot2.Reset();
            eyePlot1.Clear();

            waveCap.Start();
            deviceCombo.Enabled = false;

            recording = true;
        }
コード例 #34
0
        public void ProcessRequest(InputPin origin, string request)
        {
            string originName = origin.GetType().Name;
            Logger.LogInfo("Received a remote control command from {0} ... message = {1}", originName, request);

            if (_trainMode)
            {
                Logger.LogInfo("RCC Manager is started. All received commands will be sent to the RCC Manager instead of output pins.");

                // Send command to the RCC Manager
                RaiseInputPinDataEvent(origin, request);
                return;
            }

            foreach (RCCServiceConfig.RemoteControlRow row in _config.RemoteControl.Rows)
            {
                if (row.InputPinName == originName &&
                    row.InputPinCfgData == origin.CfgData)
                {
                    // Have found the origin input pin. 
                    // But is it enabled ?

                    if (row.Enabled)
                    {
                        // See if we have an output to send the command to ...
                        if (_outputPins.ContainsKey(row.OutputPinName + row.OutputPinCfgData))
                        {
                            // There is a valid output pin.

                            // If the destination is ProTONE Player ... is this configured to be controlled remotely ?
                            if (row.OutputPinName == typeof(ProTONEOutputPin).Name && !ProTONERemoteConfig.EnableRemoteControl)
                            {
                                // ProTONE player can't accept remoting comands.
                                // so discard the command
                                Logger.LogInfo("ProTONE has EnableRemoteControl set to False. Discarding command.");
                                return;
                            }

                            // No restrictions.
                            OutputPin destination = _outputPins[row.OutputPinName + row.OutputPinCfgData];
                            if (destination != null)
                            {
                                bool canDispatch = false;
                                RCCServiceConfig.RemoteButtonsRow button = null;

                                if (origin is RemotingInputPin && destination is ProTONEOutputPin)
                                {
                                    // This pin combination is always allowed to pass.
                                    canDispatch = true;
                                }
                                else
                                {
                                    canDispatch = DispatchToOutputPin(row.RemoteName, request, out button);
                                }

                                if (canDispatch)
                                    destination.SendRequest(request, button);

                                return;
                            }
                        }
                    }
                    else
                    {
                        Logger.LogInfo("Although an input pin was found, can't dispatch command. The origin remote control: {0} seems to be disabled.",
                            row.RemoteName);
                        return;
                    }

                    // No chance for a valid output pin ...
                    break;
                }
            }

            Logger.LogInfo("There is no valid output pin connected to input pin {0}. Check the service configuration ...", originName);
        }
コード例 #35
0
 private void RaiseInputPinDataEvent(InputPin origin, string request)
 {
     if (InputPinProbeData != null)
     {
         InputPinProbeData(origin, request);
     }
 }
コード例 #36
0
ファイル: PowerMeter.cs プロジェクト: shilrobot/bangaio
 public PowerMeter(int bufferSize)
 {
     Input = new InputPin<float>(bufferSize);
     Input.BufferFilled += new InputPin<float>.BufferFilledHandler(Input_BufferFilled);
 }
コード例 #37
0
 void _inputPinWatcher_InputPinData(InputPin origin, string request)
 {
     this.DetectedData = request;
     DialogResult = DialogResult.OK;
     Close();
 }