private void avaliablemasters_SelectedIndexChanged(object sender, EventArgs e)
        {
            clsIOLUDPIF20.clsUDPIOLMaster[] IOLMList = BNI005H.GetUDPMaster();
            if (avaliablemasters.SelectedItem != null)
            {
                int ActiveMaster = int.Parse(avaliablemasters.SelectedIndex.ToString());
                IOLM = IOLMList[ActiveMaster];
            }


            if (IOLM.IOL_Create() == clsIOLUDPIF20.eError.OK)
            {
                //Read Master Info
                WriteInfo("IO-Link UDP Master");
                WriteInfo("    IP Address:      " + IOLM.Name);
                WriteInfo("    NetworkName:      " + IOLM.NetworkName);
                WriteInfo("    Firmware Revision:      " + IOLM.RevisionFirmware);
                WriteInfo("    IO-Link Stack Revision: " + IOLM.RevisionIOLStack);
            }
        }
示例#2
0
        private void Form3_Load(object sender, EventArgs e)
        {
            BackgroundColor.SelectedItem = Enum.GetValues(typeof(Index_Colours));
            SegmentsNO.SelectedItem      = Enum.GetValues(typeof(Segments));
            RunlightColor.SelectedItem   = Enum.GetValues(typeof(Index_Colours));
            LevelLimit1.SelectedItem     = Enum.GetValues(typeof(Index_Colours));
            LevelLimit2.SelectedItem     = Enum.GetValues(typeof(Index_Colours));
            LevelLimit3.SelectedItem     = Enum.GetValues(typeof(Index_Colours));
            LevelLimit4.SelectedItem     = Enum.GetValues(typeof(Index_Colours));
            LevelLimit5.SelectedItem     = Enum.GetValues(typeof(Index_Colours));

            clsIOLUDPIF20.eError result = clsIOLUDPIF20.eError.OK;
            //tbMessages.Text = "";
            clsIOLUDPIF20.clsUDPIOLMaster[] IOLMList = BNI005H.GetUDPMaster();



            if (IOLMList.Length == 0) //jezeli nie wyszuka urzadzen
            {
                result = clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE;
                goto RError;
            }

            IOLM = IOLMList[0];

RError:     //label
            if (result == clsIOLUDPIF20.eError.DEVICE_NOT_AVAILABLE)
            {
                MessageBox.Show("Error Message: " + result.ToString() + "\r\n" +
                                "Maybe the device is not existing, or the firewall blocks the communication" + "\r\n" +
                                "Please ensure either the UDP communication or attach the network device" + "\r\n" +
                                "and start the program again", "Critical Warning");
            }
            else
            {
                MessageBox.Show("Error Message: " + result.ToString(), "Critical Warning");
                Environment.Exit(0);
            }
        }
        private void GetDeviceInfo(ref clsIOLUDPIF20.clsUDPIOLMaster Master, int Port)
        {
            //Read Info from Device with Directparameterpage

            IOLM.Port[Port].Mode.IOL_GetMode(false);


            if (IOLM.Port[Port].Mode.DeviceState.DeviceState != clsIOLUDPIF20.eDeviceState.LOST)
            {
                System.Threading.Thread.Sleep(1000);//
                Write("IO-Link Device connected:");
                Write("   VendorId:                  " + IOLM.Port[Port].Mode.DirectParameterPage1.VendorId());
                Write("   DeviceId:                  " + IOLM.Port[Port].Mode.DirectParameterPage1.DeviceId());
                Write("   IO-Link Revision:          " + IOLM.Port[Port].Mode.DirectParameterPage1.RevisionId());
                Write("   ProcessData Input Length:  " + IOLM.Port[Port].Mode.DirectParameterPage1.PDInLength());
                Write("   ProcessData Output Length: " + IOLM.Port[Port].Mode.DirectParameterPage1.PDOutLength());
                Write("   SIO mode supported:        " + IOLM.Port[Port].Mode.DirectParameterPage1.SIOModeSupported());
            }
            else
            {
                Write("No Device Connected");
            }
            // Write();
        }