Ejemplo n.º 1
0
        ISimulatorNode CreateMaster(ISimulatorNodeCallbacks callbacks)
        {
            using (var dialog = new Components.MasterDialog())
            {
                dialog.ShowDialog();
                if (dialog.DialogResult == DialogResult.OK)
                {
                    var cache        = new MeasurementCache();
                    var masterConfig = dialog.Configuration;
                    var alias        = dialog.SelectedAlias;
                    var master       = channel.AddMaster(alias, cache, DefaultMasterApplication.Instance, masterConfig);

                    if (master == null)
                    {
                        return(null);
                    }
                    else
                    {
                        master.Enable();
                        return(new MasterNode(cache, master, callbacks, alias));
                    }
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 2
0
        ISimulatorNode CreateOutstation(ISimulatorNodeCallbacks callbacks)
        {
            using (var dialog = new Components.OutstationDialog(config))
            {
                dialog.ShowDialog();
                if (dialog.DialogResult == DialogResult.OK)
                {
                    var outstationConfig = dialog.Configuration;
                    var alias            = dialog.SelectedAlias;
                    var cache            = new MeasurementCache(outstationConfig.databaseTemplate);
                    var handler          = new ProxyCommandHandler();
                    var application      = new EventedOutstationApplication();
                    var outstation       = channel.AddOutstation(alias, handler, application, outstationConfig);

                    if (outstation == null)
                    {
                        return(null);
                    }
                    else
                    {
                        outstation.Enable();
                        return(new OutstationNode(cache, handler, application, config, outstation, callbacks, alias));
                    }
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 3
0
        public MasterNode(MeasurementCache cache, IMaster master, ISimulatorNodeCallbacks callbacks, string alias)
        {
            this.cache     = cache;
            this.master    = master;
            this.callbacks = callbacks;
            this.alias     = alias;

            this.callbacks.ChangeImage(IconIndex.Master);

            this.openAction = new NodeAction("Open", () => OpenForm());
        }
Ejemplo n.º 4
0
        public OutstationNode(MeasurementCache cache, ProxyCommandHandler handler, EventedOutstationApplication application, IDNP3Config config, IOutstation outstation, ISimulatorNodeCallbacks callbacks, string alias)
        {
            this.cache       = cache;
            this.handler     = handler;
            this.application = application;
            this.config      = config;
            this.outstation  = outstation;
            this.callbacks   = callbacks;
            this.alias       = alias;

            this.callbacks.ChangeImage(IconIndex.Outstation);

            this.openAction = new NodeAction("Open", () => OpenForm());
        }
Ejemplo n.º 5
0
        public OutstationForm(IOutstation outstation, EventedOutstationApplication application, MeasurementCache cache, ProxyCommandHandler proxy, String alias)
        {
            InitializeComponent();

            this.outstation  = outstation;
            this.application = application;
            this.cache       = cache;
            this.proxy       = proxy;

            this.database = new MultiplexedDatabase(cache, outstation.GetDatabase());

            this.Text = String.Format("DNP3 Outstation ({0})", alias);
            this.comboBoxTypes.DataSource = System.Enum.GetValues(typeof(MeasType));

            this.commandHandlerControl1.Configure(proxy, database);

            this.comboBoxColdRestartMode.DataSource = System.Enum.GetValues(typeof(RestartMode));

            this.application.ColdRestart += application_ColdRestart;
            this.application.TimeWrite   += application_TimeWrite;

            this.CheckState();
        }