示例#1
0
文件: IO.cs 项目: est-by/EmeraDrv
        static internal OperationData <PhysicalInfo> ReadPhysicalInfo(QueryInfo info)
        {
            if (DataBusSetting.StubData)
            {
                return(StubUtil.StubOnReadPhysicalInfo());
            }
            var pInfo = new PhysicalInfo();
            var res   = info.Request.TryReadSerialNumber(
                info.DataBus,
                info.Cs.Address,
                info.Cs.Psw,
                out pInfo.SerialNumber);

            if (!res.IsGood)
            {
                return(OperationData <PhysicalInfo> .Bad(res));
            }
            pInfo.SerialNumber = pInfo.SerialNumber.Trim();
            string deviceConfiguration;

            res = info.Request.TryReadDeviceConfiguration(
                info.DataBus,
                info.Cs.Address,
                info.Cs.Psw,
                out deviceConfiguration);
            if (!res.IsGood)
            {
                return(OperationData <PhysicalInfo> .Bad(res));
            }
            info.SetDeviceConfiguration(deviceConfiguration);
            pInfo.SoftVersion = info.DeviceConfiguration;
            return(new OperationData <PhysicalInfo>(pInfo, res));
        }