/// <summary> /// Set PSU On/OFF /// </summary> /// <param name="psuId">Psu Id</param> /// <param name="cmd">command ON or OFF</param> /// <returns>Completion code success/failure</returns> private CompletionCode SetPsuOnOff(PmBusCommandPayload payload) { CompletionCode returnPacket = new CompletionCode(); returnPacket = CompletionCode.UnspecifiedError; try { PsuOnOffResponse response = new PsuOnOffResponse(); response = (PsuOnOffResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuPayloadRequest((byte)PmBusCommand.SET_POWER, (byte)payload, (byte)PmBusResponseLength.SET_POWER), typeof(PsuOnOffResponse)); // check for completion code if (response.CompletionCode != 0) { returnPacket = (CompletionCode)response.CompletionCode; } else { returnPacket = CompletionCode.Success; } } catch (System.Exception ex) { Tracer.WriteError("SetPsuOnOff failed with the exception: " + ex); } return(returnPacket); }
/// <summary> /// Set PSU On/OFF /// </summary> /// <param name="psuId">Psu Id</param> /// <param name="cmd">command ON or OFF</param> /// <returns>Completion code success/failure</returns> private CompletionCode SetPsuOnOff(PmBusCommandPayload payload) { CompletionCode returnPacket = new CompletionCode(); returnPacket = CompletionCode.UnspecifiedError; try { PsuOnOffResponse response = new PsuOnOffResponse(); response = (PsuOnOffResponse)this.SendReceive(this.PsuDeviceType, this.PsuId, new PsuBytePayloadRequest((byte)PmBusCommand.SET_POWER, (byte)payload, (byte)PmBusResponseLength.SET_POWER), typeof(PsuOnOffResponse)); // check for completion code if (response.CompletionCode != 0) { returnPacket = (CompletionCode)response.CompletionCode; } else { returnPacket = CompletionCode.Success; } } catch (System.Exception ex) { Tracer.WriteError("SetPsuOnOff failed with the exception: " + ex); } return returnPacket; }