Beispiel #1
0
 public virtual bool SendMessage(PlcCommand cmd, byte[] content, ref byte[] frame)
 {
     if (!IsStarted)
         return false;
     if(Comm!=null)
     {
         try
         {
             if (Comm.Send(content, 0, content.Length))
             {
                 frame = content;
                 return true;
             }
             else
             {
                 return false;
             }
         }
         catch(Exception e)
         {
             throw new APXExeception(e.Message);
         }
     }
     else
     {
         return false;
     }
 }
        public string ReadActiveReference()
        {
            byte[] data = { };
            PlcCommand.ReadActiveReference(_plcMaster, ref data);
            var result = ModbusTcpHelper.ByteArrayToAsciiString(data);

            return(result);
        }
        public string ReadProductInUnloading()
        {
            byte[] data = { };
            PlcCommand.ReadProductInUnloading(_plcMaster, ref data);
            var result = ModbusTcpHelper.ByteArrayToAsciiString(data);

            return(result);
        }
        public int[] ReadScanData()
        {
            byte[] data = {};
            PlcCommand.ReadScanData(_plcMaster, ref data);
            var dataWord = ModbusTcpHelper.ByteArrayToWordArray(data);

            return(dataWord);
        }
 public void SetVirtualIndexer(VirtualIndexerStates virtualIndexer)
 {
     PlcCommand.SetVirtualIndexer(_plcMaster, virtualIndexer);
 }
 public void SetTraceabilityStates(TraceabilityStates traceability)
 {
     PlcCommand.SetTraceabilityStates(_plcMaster, traceability);
 }
 public void UpdateProductInUnloadingStatus(ProductStatus productStatus)
 {
     PlcCommand.UpdateProductInUnloadingStatus(_plcMaster, productStatus);
 }
 public void WriteActiveReference(string reference)
 {
     PlcCommand.WriteActiveReference(_plcMaster, reference);
 }
 public void WriteProductInUnloading(string dataMatrix)
 {
     PlcCommand.WriteProductInUnloading(_plcMaster, dataMatrix);
 }
Beispiel #10
0
 public void SetUniqueIdentityLength(int length)
 {
     PlcCommand.SetUniqueIdentityLength(_plcMaster, length);
 }
Beispiel #11
0
 private byte[] BuildFrame(PlcCommand cmd, byte[] content)
 {
     byte[] frame = new byte[0];
     lock (_syncHead)
     {
         Header.SID = ++SID;
     }
     frame = Gadget.ArrayAppend(frame, Header.ToArray());
     frame = Gadget.ArrayAppend(frame, new FinsCmd(cmd).ToArray());
     frame = Gadget.ArrayAppend(frame, content);
     return frame;
 }
Beispiel #12
0
 public override bool SendMessage(PlcCommand cmd, byte[] content, ref byte[] frame)
 {
     if (!IsStarted)
         return false;
     try
     {
         frame = BuildFrame(cmd, content);
         if(Comm!=null)
         {
             if (Comm.Send(frame, 0, frame.Length))
                 return true;
             else
                 return false;
         }
         else
         {
             return false;
         }
     }
     catch(Exception e)
     {
         throw new APXExeception(e.Message);
     }
 }
Beispiel #13
0
 public FinsCmd(PlcCommand cmd)
 {
     Command = cmd;
 }