Ejemplo n.º 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;
     }
 }
Ejemplo n.º 2
0
        public string ReadActiveReference()
        {
            byte[] data = { };
            PlcCommand.ReadActiveReference(_plcMaster, ref data);
            var result = ModbusTcpHelper.ByteArrayToAsciiString(data);

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

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

            return(dataWord);
        }
Ejemplo n.º 5
0
 public void SetVirtualIndexer(VirtualIndexerStates virtualIndexer)
 {
     PlcCommand.SetVirtualIndexer(_plcMaster, virtualIndexer);
 }
Ejemplo n.º 6
0
 public void SetTraceabilityStates(TraceabilityStates traceability)
 {
     PlcCommand.SetTraceabilityStates(_plcMaster, traceability);
 }
Ejemplo n.º 7
0
 public void UpdateProductInUnloadingStatus(ProductStatus productStatus)
 {
     PlcCommand.UpdateProductInUnloadingStatus(_plcMaster, productStatus);
 }
Ejemplo n.º 8
0
 public void WriteActiveReference(string reference)
 {
     PlcCommand.WriteActiveReference(_plcMaster, reference);
 }
Ejemplo n.º 9
0
 public void WriteProductInUnloading(string dataMatrix)
 {
     PlcCommand.WriteProductInUnloading(_plcMaster, dataMatrix);
 }
Ejemplo n.º 10
0
 public void SetUniqueIdentityLength(int length)
 {
     PlcCommand.SetUniqueIdentityLength(_plcMaster, length);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 13
0
 public FinsCmd(PlcCommand cmd)
 {
     Command = cmd;
 }