using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Text;

namespace INT99DC_7C.Int_Modbus
{
    public class Modbus_30000_Data
    {
        #region Field
        private double m_UnderValue;
        private double m_PassValue;
        private double m_OverValue;
        private double m_TareValue;

        private Collection<Modbus_30000_LaneData> m_LaneModbusData;
        #endregion

        #region Constructor
        public Modbus_30000_Data()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public double UnderValue
        {
            get { return this.m_UnderValue; }
            set { this.m_UnderValue = value; }
        }
        public double PassValue
        {
            get { return this.m_PassValue; }
            set { this.m_PassValue = value; }
        }
        public double OverValue
        {
            get { return this.m_OverValue; }
            set { this.m_OverValue = value; }
        }
        public double TareValue
        {
            get { return this.m_TareValue; }
            set { this.m_TareValue = value; }
        }

        public string HexStringUnderValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.UnderValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringPassValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.PassValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringOverValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.OverValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringTareValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.TareValue);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }

        public Collection<Modbus_30000_LaneData> ModbusLaneData
        {
            get { return this.m_LaneModbusData; }
            set { this.m_LaneModbusData = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.UnderValue = 100.0;
            this.PassValue = 200.0;
            this.OverValue = 300.0;
            this.TareValue = 0.0;

            this.ModbusLaneData = new Collection<Modbus_30000_LaneData>();
            this.ModbusLaneData.Clear();

            for (int i = 0; i < 15; i++)
                this.ModbusLaneData.Add(new Modbus_30000_LaneData());
        }
        #endregion
    }
}
