public SwitchPoint(string[] segments, DateTime realTime) { if (segments == null || segments.Length != 15) { IsValid = false; return; } try { PointCode = GetPointCode(segments[0]); SubstationCode = GetPointCode(segments[1]); PointName = segments[2]; PointLocation = segments[3]; //UnitType = (UnitType)Enum.Parse(typeof(UnitType), segments[4]); //PointAreaLocation = (AreaLocation)Enum.Parse(typeof(AreaLocation), segments[5]); //PointType = (PointType)Enum.Parse(typeof(PointType), segments[6]); SensorTypeCode = segments[7]; OnDescription = segments[8]; OffDescription = segments[9]; AlarmState = segments[10].ToInt(); DismissAlarmState = segments[11].ToInt(); SwitchOffState = segments[12].ToInt(); ResumeState = segments[13].ToInt(); ControlRelations = segments[14]; SwitchPointModel = new SwitchPointModel() { EquipId = GetSensorEquipId(PointCode, PointTypeConverter.D), SubstationEquipId = SubstationCode.ToInt(), SubstationId = SubstationCode.Substring(0, 3).ToInt(), PortNO = PointCode.Substring(3, 3).ToInt(), SensorId = SensorTypeHelper.GetTargetSensorId(SensorTypeCode.ToInt()), State0Name = "断线", State1Name = OnDescription, State2Name = OffDescription, State0Warning = true, State1Warning = true, State2Warning = true }; var sensorInfo = SensorTypeHelper.GetTargetSensorInfo(SensorTypeCode.ToInt()); EquipmentInfo = new EquipmentInfoModel() { EquipId = SwitchPointModel.EquipId, PointCode = PointCode, Name = sensorInfo.SensorName, ETCode = sensorInfo.EtCode, PointId = 0, Location = PointLocation, LDate = realTime, RDate = realTime }; } catch { IsValid = false; return; } IsValid = true; }
/// <summary> /// Gets Sensor Reading /// </summary> public virtual SensorTypeCode GetSensorType(byte SensorNumber) { SensorTypeResponse response = (SensorTypeResponse)this.IpmiSendReceive( new SensorTypeRequest(SensorNumber), typeof(SensorTypeResponse)); SensorTypeCode respObj = new SensorTypeCode(response.CompletionCode); if (response.CompletionCode == 0x00) { respObj.SetParamaters(response.SensorType, response.EventTypeCode); } return(respObj); }