示例#1
0
文件: Point.cs 项目: Jaasdsa/CityIoT
        private ModbusRTUReader ToModbusRTUReader()
        {
            ModbusRTUReader read = new ModbusRTUReader();

            read.Type          = this.Type;
            read.Address       = this.PLCAddress;
            read.Length        = this.Length;
            read.Scale         = this.Scale;
            read.offsetAddress = this.offsetAddress;
            return(read);
        }
示例#2
0
文件: Point.cs 项目: Jaasdsa/CityIoT
        public void ReadValForModRTU(byte[] buffer)
        {
            this.LastTime = DataUtil.ToDateString(DateTime.Now);
            // this.LastTime = DataUtil.ToDateString(Config.LastTime);
            ModbusRTUReader read = ToModbusRTUReader();

            read.Read(buffer);
            switch (read.state)
            {
            case ValueState.Success:
            {
                this.State = read.state;
                this.Value = DataUtil.ToDouble(read.Value);
            }
            break;

            case ValueState.Fail:
            {
                MakeFail(read.mess);
                return;
            }
            }
        }