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

namespace SystemX.PLC.Interface
{
    public static class PLCCommDefinition
    {
        public delegate void EventPLCHandler(string address, int value);

        public static string ModelRoot = "PLCAddress";

        public static string DescriptionRoot = "Description";
        public static string OpearationAreaRoot = "OpearationArea";
        public static string DataAreaRoot = "DataArea";
        public static string ConnectionInfoRoot = "ConnectionInfo";

        public static char[] InvalidChars = new [] {    '\\', '\n', '\r', '@', '#', '$', '%', '^', '&',
                                                        '*', '!', '(', ')', '┌', ''};

        #region Description Attributes
        public static string DescElement = "Element";
        public static string AttrbName = "Name";
        public static string AttrbDataType = "DataType";
        public static string AttrbDesc = "Desc";
        #endregion

        #region ConnectionInfo Attributes
        public static string ConnectionInfoElement = "ConnectionDef";
        public enum eConnectionElem
        {   
            Name ,
            CPUType ,
            RWType,
            IP ,
            Port ,
            ConnectionType,
            Timeout 
        }
        #endregion

        #region PLC Address Attributes
        public static string AddrElement = "AddressElement";
        public static string AttrbAddrArea = "Area";
        public static string AttrbAddrAddress = "Address";
        public static string AttrbAddrLength = "Length";
        public static string AttrbAddrDataName = "DataName";
        public static string AttrbAddrDataType = "DataType";
        public static string AttrbAddrOperation = "Operation";
        public static string AttrbAddrDesc = "Desc";
        #endregion

        public enum ePLCRWType
        {
            Read,
            Write,
            ReadWrite 
        }

        public enum eDataType
        {
            ASCII,
            DECIMAL,
            BIT
        }

        public enum ePLCAreaType
        {
            None,
            Operation,
            Data
        }
    }
}
