/// <summary> /// Attempts to retrieve the Psu Serial Number. This method /// calls down to the Chassis Manager with SendReceive /// </summary> private PsuSerialNumberPacket GetPsuSerialNumber(byte psuId) { PsuSerialNumberPacket returnPacket = new PsuSerialNumberPacket(); returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.SerialNumber = ""; try { PsuSerialResponse myResponse = new PsuSerialResponse(); myResponse = (PsuSerialResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuRequest((byte)PmBusCommand.MFR_SERIAL, (byte)PmBusResponseLength.MFR_SERIAL), typeof(PsuSerialResponse)); // check for completion code if (myResponse.CompletionCode != 0) { returnPacket.CompletionCode = (CompletionCode)myResponse.CompletionCode; } else { returnPacket.CompletionCode = CompletionCode.Success; if (myResponse.PsuSerialNumber != null) { byte[] inSerialNumber = myResponse.PsuSerialNumber; byte[] outSerialNumber = null; PmBus.PsuSerialNumberParser(ref inSerialNumber, out outSerialNumber); returnPacket.SerialNumber = System.BitConverter.ToString(outSerialNumber, 0); } else { returnPacket.SerialNumber = ""; } } } catch (System.Exception ex) { returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.SerialNumber = ""; Tracer.WriteError(this.PsuId, DeviceType.Psu, ex); } return(returnPacket); }
/// <summary> /// Attempts to retrieve the Psu Serial Number. This method /// calls down to the Chassis Manager with SendReceive /// </summary> private PsuSerialNumberPacket GetPsuSerialNumber(byte psuId) { PsuSerialNumberPacket returnPacket = new PsuSerialNumberPacket(); returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.SerialNumber = ""; try { PsuSerialResponse myResponse = new PsuSerialResponse(); myResponse = (PsuSerialResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuRequest((byte)PmBusCommand.MFR_SERIAL,(byte)PmBusResponseLength.MFR_SERIAL), typeof(PsuSerialResponse)); // check for completion code if (myResponse.CompletionCode != 0) { returnPacket.CompletionCode = (CompletionCode)myResponse.CompletionCode; } else { returnPacket.CompletionCode = CompletionCode.Success; if (myResponse.PsuSerialNumber != null) { byte[] inSerialNumber = myResponse.PsuSerialNumber; byte[] outSerialNumber = null; PmBus.PsuSerialNumberParser(ref inSerialNumber, out outSerialNumber); returnPacket.SerialNumber = System.BitConverter.ToString(outSerialNumber, 0); } else { returnPacket.SerialNumber = ""; } } } catch (System.Exception ex) { returnPacket.CompletionCode = CompletionCode.UnspecifiedError; returnPacket.SerialNumber = ""; Tracer.WriteError(this.PsuId, DeviceType.Psu, ex); } return returnPacket; }