예제 #1
0
        public FixedData(_UD_Base UD, BinaryReader source)
            : base(UD)
        {
            {
                byte[] buf = new byte[4];
                if (source.Read(buf, 0, buf.Length) != buf.Length)
                {
                    throw new InvalidDataException();
                }
                IdentificationNo = UInt32.Parse(buf.BCDToString());
            }
            AccessNo = source.ReadByte();
            byte Status      = source.ReadByte();
            bool CountersBCD = (Status & 0x01) == 0;

            CountersFixed = (Status & 0x02) != 0;
            byte buf6 = source.ReadByte();;
            byte buf7 = source.ReadByte();;

            Units1 = (UnitsFixedData)(buf6 & 0x3F);
            Units2 = (UnitsFixedData)(buf7 & 0x3F);
            Medium = (MediumFixedData)(((buf6 & 0xc0) >> 6) | ((buf7 & 0xc0) >> 4));
            if (CountersBCD)
            {
                byte[] buf8 = new byte[4];
                if (source.Read(buf8, 0, buf8.Length) != buf8.Length)
                {
                    throw new InvalidDataException();
                }
                Counter1 = UInt32.Parse(buf8.BCDToString());
                byte[] buf12 = new byte[4];
                if (source.Read(buf12, 0, buf12.Length) != buf12.Length)
                {
                    throw new InvalidDataException();
                }
                Counter2 = UInt32.Parse(buf12.BCDToString());
            }
            else
            {
                Counter1 = source.ReadUInt32();
                Counter2 = source.ReadUInt32();
            }
        }
예제 #2
0
 public ApplicationError(_UD_Base UD, byte code)
     : this(UD, (Codes)code)
 {
 }
예제 #3
0
 public ApplicationError(_UD_Base UD, Codes code)
     : base(UD.AccessDemand, UD.DataFlowControl, UD.Address)
 {
     this.Code = code;
 }
예제 #4
0
 public AlarmStatus(_UD_Base UD, byte status)
     : base(UD.AccessDemand, UD.DataFlowControl, UD.Address)
 {
     this.status = status;
 }
예제 #5
0
 public VariableData(_UD_Base UD, BinaryReader source)
     : base(UD)
 {
     header = new FixedDataHeader(source);
     Items  = GetItems(source);
 }
예제 #6
0
 public _UD_Data(_UD_Base UD)
     : base(UD.AccessDemand, UD.DataFlowControl, UD.Address)
 {
 }