/// <summary> /// Gets Sensor Reading Factors /// </summary> internal ReadingFactorsResponse GetSensorFactors(byte SensorNumber, byte SensorReading) { ReadingFactorsResponse response = (ReadingFactorsResponse)this.IpmiSendReceive( new ReadingFactorsRequest(SensorNumber, SensorReading), typeof(ReadingFactorsResponse)); return(response); }
/// <summary> /// Format Sensor Data Records /// </summary> internal void GetSdrMetatData(short id, decimal version, byte recordType, SdrRecord record, ref SdrCollection sdrMessages) { SdrRecordType sdrRecordType; int sensorType = (int)recordType; // convert message type to to enum or return unspecified if (Enum.IsDefined(typeof(SdrRecordType), sensorType)) { sdrRecordType = (SdrRecordType)sensorType; } else { sdrRecordType = SdrRecordType.Unspecified; } switch (sdrRecordType) { case SdrRecordType.Full: // Full Sensor { #region full Record if (record.RecordData != null) { // Create sensor data record. FullSensorRecord str; // IPMI Spec [Table 43-1] Byte 24 Linearization // [7] - reserved // [6:0] - enum (linear, ln, log10, log2, e, exp10, exp2, 1/x, sqr(x), cube(x), sqrt(x), // cube-1 (x) ) // 70h = non-linear. 71h-7Fh = non-linear, OEM defined. byte linearByte = (byte)(record.RecordData[23] & 0x7F); if (linearByte > 0x0B && linearByte <= 0x7F) { // get current sensor reading using get sensor reading ipmi command SensorReadingResponse reading = (SensorReadingResponse)this.IpmiSendReceive( new SensorReadingRequest(record.RecordData[7]), typeof(SensorReadingResponse)); if (reading.CompletionCode == 0) { // non linear sensors require the get sensor reading factores command to retrieve reading // factors. ReadingFactorsRequest(Sensornumber, SensorReading) ReadingFactorsResponse factors = (ReadingFactorsResponse)this.IpmiSendReceive( new ReadingFactorsRequest(record.RecordData[7], reading.SensorReading), typeof(ReadingFactorsResponse)); // Initialize the sdr message class with reading & factors str = new FullSensorRecord(id, version, sdrRecordType, record, factors.Factors, factors.CompletionCode ); } else { // Initialize the sdr message class with reading & factors str = new FullSensorRecord(id, version, sdrRecordType, record, new byte[6], // initialize with blank conversation factors. reading.CompletionCode ); } } else { // Initialize the sdr message class str = new FullSensorRecord(id, version, sdrRecordType, record, record.completionCode ); } // append message to collection sdrMessages.Add(str); } #endregion } break; case SdrRecordType.Compact: // Compact Sensor { #region Compact Sensor // Initialize the sdr message class CompactSensorRecord sdr = new CompactSensorRecord(id, version, sdrRecordType, record ); //SdrRecordCompact(ref str, record); sdrMessages.Add(sdr); #endregion } break; case SdrRecordType.EventOnly: // Event-Only { #region Event Only SdrEventOnlyRecord sdr = new SdrEventOnlyRecord(id, version, sdrRecordType, record ); //SdrRecordCompact(ref str, record); sdrMessages.Add(sdr); #endregion } break; case SdrRecordType.Association: // Entity Association case SdrRecordType.DeviceRelative: // Device-relative Entity case SdrRecordType.GenericDevice: // Generic Device Locator case SdrRecordType.FRUDevice: // FRU Device Locator case SdrRecordType.ManagementDevice: // Management Controller Device case SdrRecordType.ManagementController: // Management Controller Confirmation case SdrRecordType.BmcMessageChannel: // BMC Message Channel Info case SdrRecordType.Oem: // OEM Record default: // 0x0A = 0x0F reserved break; } }