コード例 #1
0
        public string PcccLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            if (e.InTagName == "N227:0")
            {
                e.OutTagName = "N228:0";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            retArr[20] = e.SuccessIndicator;
            retArr[21] = e.FaultCode;

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                return(s.PlcResponse(e.SenderIp, retArr, e.OutTagName));
            }
            else if (e.UsePlcMicrologix)
            {
                return(s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName));
            }
            else
            {
                return(s.SlcResponse(e.SenderIp, retArr, e.OutTagName));
            }
        }
コード例 #2
0
        public void EipFinalPrintResponse(LabelPrintEventArgs e)
        {
            var retArr = new short[10];

            e.OutTagName = e.InTagName;
            short.TryParse(e.Response, out retArr[0]);
            var s = new PlcWriter();

            s.LogixResponse(e.SenderIp, retArr, e.OutTagName);
        }
コード例 #3
0
        public void EipSerialRequestRespone(SerialRequestEventArgs e)
        {
            var retArr = new short[20];

            e.OutTagName = "N247[0]";
            Array.Copy(e.ResponseArray, 0, retArr, 0, e.ResponseArray.Length);
            var s = new PlcWriter();

            s.LogixResponse(e.SenderIp, retArr, e.OutTagName);
        }
コード例 #4
0
        public void EipLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            e.OutTagName = e.InTagName;
            retArr[20]   = e.SuccessIndicator;
            retArr[21]   = e.FaultCode;

            var s = new PlcWriter();

            s.LogixResponse(e.SenderIp, retArr, e.OutTagName);
        }
コード例 #5
0
        public void EipPlcModelSetupResponse(string ipAddress, SetupEventArgs e)
        {
            var retArr = e.PlcModelSetup;
            //for (var i = 0; i < e.Response.PlcModelSetup.Length; i++)
            //{
            //    short.TryParse(e.Response.PlcModelSetup[i], out retArr[i]);
            //}

            var s = new PlcWriter();

            s.LogixResponse(ipAddress, retArr, "N241[0]");
        }
コード例 #6
0
        public void PcccProductionResponse(ProductionEventArgs e)
        {
            var retArr = new short[50];

            if (e.InTagName == "N197:0")
            {
                e.OutTagName = "N198:0";
            }
            else if (e.InTagName == "N207:0")
            {
                e.OutTagName = "N208:0";
            }
            else if (e.InTagName == "N217:0")
            {
                e.OutTagName = "N218:0";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            var cellArr = Util.StringToAbIntArray(e.CellId);

            Array.Copy(cellArr, 0, retArr, 0, cellArr.Length);

            var itemArr = Util.StringToAbIntArray(e.ItemId);

            Array.Copy(itemArr, 0, retArr, 5, itemArr.Length);

            Array.Copy(e.ResponseArray, 18, retArr, 18, 32);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
コード例 #7
0
        public string EipProductionResponse(ProductionEventArgs e)
        {
            var retArr = new short[50];

            if (e.InTagName == "N197[0]")
            {
                e.OutTagName = "N198[0]";
            }
            else if (e.InTagName == "N207[0]")
            {
                e.OutTagName = "N208[0]";
            }
            else if (e.InTagName == "N217[0]")
            {
                e.OutTagName = "N218[0]";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            var cellArr = Util.StringToAbIntArray(e.CellId);

            Array.Copy(cellArr, 0, retArr, 0, cellArr.Length);

            var itemArr = Util.StringToAbIntArray(e.ItemId);

            Array.Copy(itemArr, 0, retArr, 5, itemArr.Length);

            Array.Copy(e.ResponseArray, 18, retArr, 18, 32);


            var s      = new PlcWriter();
            var status = s.LogixResponse(e.SenderIp, retArr, e.OutTagName);

            if (Logger.Enabled)
            {
                Logger.Log("listener complete");
            }

            return(status);
        }
コード例 #8
0
        public string EipLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            if (e.InTagName == "N227[0]")
            {
                e.OutTagName = "N228[0]";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            retArr[20] = e.SuccessIndicator;
            retArr[21] = e.FaultCode;

            var s = new PlcWriter();

            return(s.LogixResponse(e.SenderIp, retArr, e.OutTagName));
        }
コード例 #9
0
        public void PcccFinalPrintResponse(LabelPrintEventArgs e)
        {
            var retArr = new short[10];

            e.OutTagName = e.InTagName;
            short.TryParse(e.Response, out retArr[0]);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            };
        }
コード例 #10
0
        public void PcccSerialRequestRespone(SerialRequestEventArgs e)
        {
            var retArr = new short[20];

            e.OutTagName = "N247:0";
            Array.Copy(e.ResponseArray, 0, retArr, 0, e.ResponseArray.Length);

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
コード例 #11
0
        public void PcccLoginResponse(LoginEventArgs e)
        {
            var retArr = new short[34];

            e.OutTagName = e.InTagName;
            retArr[20]   = e.SuccessIndicator;
            retArr[21]   = e.FaultCode;

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
        }
コード例 #12
0
        public void PcccPlcModelSetupResponse(string ipAddress, SetupEventArgs e)
        {
            var retArr = e.PlcModelSetup;
            //for (var i = 0; i < e.Response.PlcModelSetup.Length; i++)
            //{
            //    short.TryParse(e.Response.PlcModelSetup[i], out retArr[i]);
            //}

            var s = new PlcWriter();

            if (e.UsePlcFive)
            {
                s.PlcResponse(e.SenderIp, retArr, "N241:0");
            }
            else if (e.UsePlcMicrologix)
            {
                s.MicroLogixResponse(e.SenderIp, retArr, "N241:0");
            }
            else
            {
                s.SlcResponse(e.SenderIp, retArr, "N241:0");
            }
        }
コード例 #13
0
        public void EipSetupResponse(SetupEventArgs e)
        {
            e.ParseReturnData();

            e.OutTagName = "N238[0]";
            var retArr = new short[71];

            if (!string.IsNullOrEmpty(e.Response.Component1.AccessId))
            {
                Int16.TryParse(e.Response.Component1.AccessId, out retArr[0]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component1.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 1, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component2.AccessId))
            {
                Int16.TryParse(e.Response.Component2.AccessId, out retArr[11]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component2.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 12, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component3.AccessId))
            {
                Int16.TryParse(e.Response.Component3.AccessId, out retArr[22]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component3.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 23, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component4.AccessId))
            {
                Int16.TryParse(e.Response.Component4.AccessId, out retArr[33]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component4.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 34, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component5.AccessId))
            {
                Int16.TryParse(e.Response.Component5.AccessId, out retArr[44]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component5.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 45, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component6.AccessId))
            {
                Int16.TryParse(e.Response.Component6.AccessId, out retArr[55]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component6.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 56, componentModelArr.Length);
            }
            // add quantity
            if (!Int32.TryParse(e.Response.Quantity, out int result))
            {
                result = 0;
            }
            if (result > 9999)
            {
                var small = result - 10000;
                var big   = (result - small) * 0.0001;
                retArr[66] = (short)big;
                retArr[65] = (short)small;
            }
            else
            {
                retArr[65] = (byte)result;
            }

            Int16.TryParse(e.Response.Acknowledge, out retArr[67]);

            Int16.TryParse(e.Response.ErrorCode, out retArr[68]);
            var s = new PlcWriter();

            s.LogixResponse(e.SenderIp, retArr, e.OutTagName);

            if (e.ProcessIndicator == 4)
            {
                EipPlcModelSetupResponse(e.SenderIp, e);
            }
        }
コード例 #14
0
        public void EipProductionResponse(ProductionEventArgs e)
        {
            var retArr = new short[50];

            if (e.InTagName == "N197[0]")
            {
                e.OutTagName = "N198[0]";
            }
            else if (e.InTagName == "N207[0]")
            {
                e.OutTagName = "N208[0]";
            }
            else if (e.InTagName == "N217[0]")
            {
                e.OutTagName = "N218[0]";
            }
            else
            {
                e.OutTagName = e.InTagName;
            }

            var cellArr = Util.StringToAbIntArray(e.CellId);

            Array.Copy(cellArr, 0, retArr, 0, cellArr.Length);

            var itemArr = Util.StringToAbIntArray(e.ItemId);

            Array.Copy(itemArr, 0, retArr, 5, itemArr.Length);

            Array.Copy(e.ResponseArray, 18, retArr, 18, 32);

            //retArr[18] = Convert.ToInt16(e.ProcessIndicator);
            //retArr[19] = Convert.ToInt16(e.SuccessIndicator);
            //retArr[20] = 0;
            //retArr[21] = Convert.ToInt16(e.FaultCode);
            //retArr[22] = e.P_Val_1;
            //retArr[23] = e.P_Val_2;
            //retArr[24] = e.P_Val_3;
            //retArr[25] = e.P_Val_4;
            //retArr[26] = e.P_Val_5;
            //retArr[27] = e.P_Val_6;
            //retArr[28] = e.P_Val_7;
            //retArr[29] = e.P_Val_8;
            //retArr[30] = e.P_Val_9;
            //retArr[31] = e.P_Val_10;
            //retArr[32] = e.P_Val_11;
            //retArr[33] = e.P_Val_12;
            //retArr[34] = e.P_Val_13;
            //retArr[35] = e.P_Val_14;
            //retArr[36] = e.P_Val_15;
            //retArr[37] = e.P_Val_16;
            //retArr[38] = e.P_Val_17;
            //retArr[39] = e.P_Val_18;
            //retArr[40] = e.P_Val_19;
            //retArr[41] = e.P_Val_20;
            //retArr[42] = e.P_Val_21;
            //retArr[43] = e.P_Val_22;
            //retArr[44] = e.P_Val_23;
            //retArr[45] = e.P_Val_24;
            //retArr[46] = e.P_Val_25;
            //retArr[47] = e.P_Val_26;
            //retArr[48] = e.P_Val_27;
            //retArr[49] = e.P_Val_28;

            var s = new PlcWriter();

            s.LogixResponse(e.SenderIp, retArr, e.OutTagName);
            if (Logger.Enabled)
            {
                Logger.Log("listener complete");
            }
        }
コード例 #15
0
        public string PcccSetupResponse(SetupEventArgs e)
        {
            e.ParseReturnData();

            e.OutTagName = "N238:0";
            var retArr = new short[71];

            if (!string.IsNullOrEmpty(e.Response.Component1.AccessId))
            {
                Int16.TryParse(e.Response.Component1.AccessId, out retArr[0]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component1.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 1, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component2.AccessId))
            {
                Int16.TryParse(e.Response.Component2.AccessId, out retArr[11]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component2.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 12, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component3.AccessId))
            {
                Int16.TryParse(e.Response.Component3.AccessId, out retArr[22]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component3.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 23, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component4.AccessId))
            {
                Int16.TryParse(e.Response.Component4.AccessId, out retArr[33]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component4.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 34, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component5.AccessId))
            {
                Int16.TryParse(e.Response.Component5.AccessId, out retArr[44]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component5.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 45, componentModelArr.Length);
            }
            if (!string.IsNullOrEmpty(e.Response.Component6.AccessId))
            {
                Int16.TryParse(e.Response.Component6.AccessId, out retArr[55]);
                var componentModelArr = Util.StringToAbIntArray(e.Response.Component6.ModelNumber);
                Array.Copy(componentModelArr, 0, retArr, 56, componentModelArr.Length);
            }
            // add quantity
            if (!Int32.TryParse(e.Response.Quantity, out int result))
            {
                result = 0;
            }
            if (result > 9999)
            {
                var small = result - 10000;
                var big   = (result - small) * 0.0001;
                retArr[66] = (short)big;
                retArr[65] = (short)small;
            }
            else
            {
                retArr[65] = (short)result;
            }

            Int16.TryParse(e.Response.Acknowledge, out retArr[67]);

            Int16.TryParse(e.Response.ErrorCode, out retArr[68]);
            var s = new PlcWriter();

            var status = "";

            if (e.UsePlcFive)
            {
                status = s.PlcResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else if (e.UsePlcMicrologix)
            {
                status = s.MicroLogixResponse(e.SenderIp, retArr, e.OutTagName);
            }
            else
            {
                status = s.SlcResponse(e.SenderIp, retArr, e.OutTagName);
            }

            if (e.ProcessIndicator == 4)
            {
                var pushDownStatus = PcccPlcModelSetupResponse(e.SenderIp, e);
                if (pushDownStatus != "GOOD")
                {
                    status = string.Format("PLC Model Download - {0}", pushDownStatus);
                }
            }

            return(status);
        }