using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; 

namespace WCS.Core
{
    public class PLC : EntityEx<PLCInfo>
    {
        public PLC(PLCInfo ent) : base(ent)
        {
            if (Configs.PLCAccessorCreater != null)
            {
                Accessor = Configs.PLCAccessorCreater.Create(ent);
            }
            else
                throw new Exception("Configs.PLCAccessorCreater未赋值");
           
        }      
        public IPLCAccessor Accessor { get; private set; }
      
    }

    public interface IPLCAccessorCreater
    {
        IPLCAccessor Create(PLCInfo data);
    }
    public interface IPLCAccessor
    {
        void WriteBytes(ushort db, ushort address, byte[] data);
        byte[] ReadBytes(ushort db, ushort address, ushort length);
    }
}
