using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks; 

namespace WCS.Core
{
    public enum PLCType
    { 
        [Description("西门子")]
        Siemens = 1,
        [Description("三菱")]
        Mitsubishi = 2,
        [Description("欧姆龙")]
        Omron = 3,
    }

    public struct PLCInfo
    {
        public string IP { get; set; }
        public int Port { get; set; }
        public int Slot { get; set; }
        public int Rack { get; set; }
        public PLCType Type { get; set; }
    }

    public struct DBInfo
    {
        public PLCInfo PLCInfo { get; set; }
        public ushort No { get; set; }
    }

    public struct ProtocolInfo
    {
        public DBInfo DBInfo { get; set; }
        public int Position { get; set; } 
    }


    public abstract class DeviceData
    {
        public string Code { get; set; } = "";
        public DateTime Frame { get; set; }
        public string Message { get; set; } = "";
    } 
    public abstract class DeviceData<T> : DeviceData
    { 
        public T Data { get; private set; }



        protected abstract T Convert<TSource>(TSource source);
    }
}
