Example #1
0
        public Client(string hostname, int port, string apTitleR, int aeQualifierR, uint pSelectorR, byte[] sSelectorR, byte[] tSelectorR,
                      string apTitleL, int aeQualifierL, uint pSelectorL, byte[] sSelectorL, byte[] tSelectorL, bool enabled, string password)
        {
            try
            {
                _hostname = hostname;
                _port     = port;

                _parameters = _connection.GetConnectionParameters();
                if (!string.IsNullOrEmpty(apTitleR) && !string.IsNullOrEmpty(aeQualifierR.ToString()))
                {
                    _parameters.SetRemoteApTitle(apTitleR, aeQualifierR);
                }
                if (!string.IsNullOrEmpty(pSelectorR.ToString()) && sSelectorR != null && tSelectorR != null)
                {
                    _parameters.SetRemoteAddresses(pSelectorR, sSelectorR, tSelectorR);
                }
                if (!string.IsNullOrEmpty(apTitleL) && !string.IsNullOrEmpty(aeQualifierL.ToString()))
                {
                    _parameters.SetLocalApTitle(apTitleL, aeQualifierL);
                }
                if (!string.IsNullOrEmpty(pSelectorL.ToString()) && sSelectorL != null && tSelectorL != null)
                {
                    _parameters.SetLocalAddresses(pSelectorL, sSelectorL, tSelectorL);
                }
                if (enabled && !string.IsNullOrEmpty(password))
                {
                    _parameters.UsePasswordAuthentication(password);
                }
            }
            catch (Exception e)
            {
                Log.Write(e, Log.Code.ERROR);
            }
        }
Example #2
0
 private void comboBoxIED_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (iedsDb.ContainsKey((string)comboBoxIED.SelectedItem))
     {
         par = iedsDb[(string)comboBoxIED.SelectedItem];
         initValues();
     }
 }
Example #3
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args[0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);


            try
            {
                IsoConnectionParameters parameters = con.GetConnectionParameters();

                parameters.SetRemoteAddresses(1, new byte[] { 0x00, 0x01 }, new byte[] { 0x00, 0x01, 0x02, 0x03 });

                con.ConnectTimeout = 10000;

                con.GetMmsConnection().SetLocalDetail(1200);

                con.Connect(hostname, 102);

                Console.WriteLine("Negotiated PDU size: " + con.GetMmsConnection().GetLocalDetail());

                List <string> serverDirectory = con.GetServerDirectory(false);

                foreach (string entry in serverDirectory)
                {
                    Console.WriteLine("LD: " + entry);
                }

                con.Release();
            }
            catch (IedConnectionException e)
            {
                Console.WriteLine(e.Message);
            }

            // release all resources - do NOT use the object after this call!!
            con.Dispose();
        }
Example #4
0
 private void RelayManagment_Load(object sender, EventArgs e)
 {
     // DbReport = MesVariables.DbReport;  //
     Dbisopen            = false;
     IEDConnected        = false;
     OPCconnected        = false;
     firstUse            = true;
     Valeur              = Class.SPCS;
     database_connection = new SQLiteConnection("Data Source=:memory:;Version=3;;cache=shared");
     ConnectToIED        = new IedConnection();
     param = ConnectToIED.GetConnectionParameters();
     initialiser();
     password = "******";
     hostname = "192.168.1.65";
 }
Example #5
0
        public ConnParamDialog(IsoConnectionParameters param, Dictionary <string, IsoConnectionParameters> ieds)
        {
            InitializeComponent();
            iedsDb = ieds;
            par    = param;

            comboBoxIED.Items.Add("");
            foreach (string s in iedsDb.Keys)
            {
                comboBoxIED.Items.Add(s);
            }
            if (iedsDb.ContainsKey(par.hostname))
            {
                comboBoxIED.SelectedItem = par.hostname;
            }
            initValues();
        }
Example #6
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args[0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);


            try
            {
                IsoConnectionParameters parameters = con.GetConnectionParameters();

                parameters.UsePasswordAuthentication("top secret");

                con.Connect(hostname, 102);

                List <string> serverDirectory = con.GetServerDirectory(false);

                foreach (string entry in serverDirectory)
                {
                    Console.WriteLine("LD: " + entry);
                }

                con.Release();
            }
            catch (IedConnectionException e)
            {
                Console.WriteLine(e.Message);
            }


            // release all resources - do NOT use the object after this call!!
            con.Dispose();
        }
Example #7
0
 private void toolStripButton_Run_Click(object sender, EventArgs e)
 {
     toolStripButton_Stop.Enabled = true;
     toolStripButton_Stop.ImageTransparentColor = System.Drawing.Color.LightYellow;
     if (toolStripComboBox_Hostname.Items.Count == 0)
     {
         toolStripComboBox_Hostname.Items.Add("localhost");
     }
     toolStripButton_Run.Enabled = false;
     AddAndSaveMruIp();
     try { isoPar = iedsDb[toolStripComboBox_Hostname.Text]; }  // read parameters of the current ied
     catch { isoPar = null; }
     if (isoPar == null)
     {
         isoPar          = new IsoConnectionParameters((IsoAcse.AcseAuthenticationParameter)null);
         isoPar.hostname = toolStripComboBox_Hostname.Text;
     }
     worker.Start(isoPar);
 }
Example #8
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args[0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);


            try
            {
                IsoConnectionParameters parameters = con.GetConnectionParameters();

                parameters.SetRemoteAddresses(1, 1, new byte[] { 0x00, 0x01, 0x02, 0x03 });

                con.ConnectTimeout = 10000;

                con.Connect(hostname, 102);

                List <string> serverDirectory = con.GetServerDirectory(false);

                foreach (string entry in serverDirectory)
                {
                    Console.WriteLine("LD: " + entry);
                }

                con.Release();
            }
            catch (IedConnectionException e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #9
0
        private void toolStripButtonConnParam_Click(object sender, EventArgs e)
        {
            try { isoPar = iedsDb[toolStripComboBox_Hostname.Text]; }
            catch { isoPar = null; }   // read parameters of the current ied
            if (isoPar == null)
            {
                isoPar          = new IsoConnectionParameters((IsoAcse.AcseAuthenticationParameter)null);
                isoPar.hostname = toolStripComboBox_Hostname.Text;
            }

            ConnParamDialog cd  = new ConnParamDialog(isoPar, iedsDb);
            DialogResult    res = cd.ShowDialog();

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                StringDictionary std = new StringDictionary();
                isoPar.Save(std);   // Write parameters to dictionary
                foreach (string key in std.Keys)
                {
                    ieds.writeString(std["hostname"], key, std[key]);
                }
                iedsDb[std["hostname"]] = isoPar;
            }
        }
Example #10
0
 public void NewParameters()
 {
     _parameters = null;
 }