/// <summary> /// This function returns the EDID data for the specified GPU handle and connection bit mask. /// outputId should have exactly 1 bit set to indicate a single display. /// </summary> /// <param name="gpuHandle">Physical GPU handle to check outputs</param> /// <param name="outputId">Output identification</param> /// <returns>Whole or a part of the EDID data</returns> /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception> /// <exception cref="NVIDIAApiException"> /// Status.InvalidArgument: gpuHandle or edid is invalid, outputId has 0 or > 1 bits /// set /// </exception> /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception> /// <exception cref="NVIDIAApiException">Status.DataNotFound: The requested display does not contain an EDID.</exception> /// <exception cref="Exception">A delegate callback throws an exception.</exception> public static IEDID GetEDID(PhysicalGPUHandle gpuHandle, OutputId outputId) { var gpuGetEDID = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetEDID>(); foreach (var acceptType in gpuGetEDID.Accepts()) { using (var edidReference = ValueTypeReference.FromValueType(acceptType.Instantiate <IEDID>(), acceptType) ) { var status = gpuGetEDID(gpuHandle, outputId, edidReference); if (status == Status.IncompatibleStructureVersion) { continue; } if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(edidReference.ToValueType <IEDID>(acceptType)); } } throw new NVIDIANotSupportedException("This operation is not supported."); }
/// <summary> /// This function returns the EDID data for the specified GPU handle and connection bit mask. /// outputId should have exactly 1 bit set to indicate a single display. /// </summary> /// <param name="gpuHandle">Physical GPU handle to check outputs</param> /// <param name="outputId">Output identification</param> /// <param name="offset">EDID offset</param> /// <param name="readIdentification">EDID read identification for multi part read, or zero for first run</param> /// <returns>Whole or a part of the EDID data</returns> /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception> /// <exception cref="NVIDIAApiException"> /// Status.InvalidArgument: gpuHandle or edid is invalid, outputId has 0 or > 1 bits /// set /// </exception> /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception> /// <exception cref="NVIDIAApiException">Status.DataNotFound: The requested display does not contain an EDID.</exception> /// <exception cref="Exception">A delegate callback throws an exception.</exception> // ReSharper disable once TooManyArguments public static EDIDV3 GetEDID( PhysicalGPUHandle gpuHandle, OutputId outputId, int offset, int readIdentification = 0) { var gpuGetEDID = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_GetEDID>(); if (!gpuGetEDID.Accepts().Contains(typeof(EDIDV3))) { throw new NVIDIANotSupportedException("This operation is not supported."); } var instance = EDIDV3.CreateWithOffset((uint)readIdentification, (uint)offset); using (var edidReference = ValueTypeReference.FromValueType(instance)) { var status = gpuGetEDID(gpuHandle, outputId, edidReference); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(edidReference.ToValueType <EDIDV3>().GetValueOrDefault()); } }
public BlinkGameOutput(String Name, OutputId Id, int BlinkTimerInterval) : base(Name, Id) { _BlinkTimer = new Timer(); _BlinkTimer.Interval = BlinkTimerInterval; _BlinkTimer.Enabled = true; _BlinkTimer.Elapsed += new ElapsedEventHandler(BlinkTimer_Elapsed); }
public OutputId Write(string input) { var id = new OutputId { Left = CursorLeft, Length = input.Length }; System.Console.Write(input); return(id); }
/// <summary> /// Update a value for the desired GameOutput /// </summary> /// <param name="Id">GameOutput Id to update</param> /// <param name="Value">Value to update the GameOutput object</param> protected void SetOutputValue(OutputId Id, int Value) { foreach (GameOutput CurrentOutput in _Outputs) { if (CurrentOutput.Id == (uint)Id) { CurrentOutput.OutputValue = Value; break; } } }
/// <summary> /// Return a GameOutput object corresponding to a desired GameOutputId /// </summary> /// <param name="Id">Desired GameOutputId</param> /// <returns>Desired GameOutput object</returns> protected GameOutput GetOutputById(OutputId Id) { foreach (GameOutput CurrentOutput in _Outputs) { if (CurrentOutput.Id == (uint)Id) { return(CurrentOutput); } } return(null); }
public AsyncGameOutput(String Name, OutputId Id, int AsyncResetTimerOnInterval, int AsyncResetTimerOffInterval, int RestValue) : base(Name, Id) { _OffValue = RestValue; _AsyncResetTimerOnInterval = AsyncResetTimerOnInterval; _AsyncResetTimerOffInterval = AsyncResetTimerOffInterval; _AsyncResetTimer = new Timer(); _AsyncResetTimer.Interval = AsyncResetTimerOnInterval; _AsyncResetTimer.Enabled = true; _AsyncResetTimer.Stop(); _AsyncResetTimer.Elapsed += new ElapsedEventHandler(AsyncResetTimer_Elapsed); }
/// <summary>Get the IO visual for an IO output</summary> /// <param name="id">The state machine output id</param> /// <returns>The corresponding visual object</returns> UC_Output GetCtrl(OutputId id) { switch (id) { case OutputId.GasNitrogen: return(this.gasNitrogenOut); case OutputId.GasOxygen: return(this.gasOxygenOut); case OutputId.Heater: return(this.heaterOut); default: return(this.gasNitrogenOut); } }
/// <summary> /// This function determines if a set of GPU outputs can be active simultaneously. While a GPU may have 'n' outputs, /// typically they cannot all be active at the same time due to internal resource sharing. /// Given a physical GPU handle and a mask of candidate outputs, this call will return true if all of the specified /// outputs can be driven simultaneously. It will return false if they cannot. /// </summary> /// <param name="gpuHandle">Physical GPU handle to check outputs</param> /// <param name="outputIds">Output identification combination</param> /// <returns>true if all of the specified outputs can be driven simultaneously. It will return false if they cannot.</returns> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: display is not valid</exception> /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception> public static bool ValidateOutputCombination(PhysicalGPUHandle gpuHandle, OutputId outputIds) { var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_GPU_ValidateOutputCombination>()(gpuHandle, outputIds); if (status == Status.InvalidCombination) { return(false); } if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(true); }
// ----- Callbacks private void FlickrOnOnUploadProgress(object sender, UploadProgressEventArgs args) { if (args.UploadComplete) { if (_lastOuput != null) { _console.Clean(_lastOuput); } _watch.Stop(); } else { var speed = args.BytesSent / _watch.ElapsedMilliseconds * 1000; var timeRemaining = speed == 0 ? TimeSpan.Zero : TimeSpan.FromSeconds((args.TotalBytesToSend - args.BytesSent) / speed); var ouput = $"{args.ProcessPercentage} % ({args.BytesSent.ToOctets()} on {args.TotalBytesToSend.ToOctets()} - {speed.ToOctets()}/s, time remaning {timeRemaining})"; if (_lastOuput != null) { _console.Clean(_lastOuput); } _lastOuput = _console.Write(ouput); } }
/// <summary> /// Creates a new instance of this class using a OutputId /// </summary> /// <param name="outputId">The output identification of a display or an output</param> public DVCInformation(OutputId outputId) { _outputId = outputId; }
public GameOutput(String Name, OutputId Id) { _Name = Name; _Id = (UInt32)Id; _OutputValue = 0; }
/// <summary> /// This API converts a Physical GPU handle and output ID to a display ID. /// </summary> /// <param name="gpuHandle">Handle to the physical GPU</param> /// <param name="outputId">Connected display output identification on the target GPU - must only have one bit set</param> /// <returns>Display identification</returns> /// <exception cref="NVIDIAApiException">Status.ApiNotInitialized: NVAPI not initialized</exception> /// <exception cref="NVIDIAApiException">Status.Error: miscellaneous error occurred</exception> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: Invalid input parameter.</exception> public static uint GetDisplayIdFromGPUAndOutputId(PhysicalGPUHandle gpuHandle, OutputId outputId) { var status = DelegateFactory.GetDelegate <Delegates.GPU.NvAPI_SYS_GetDisplayIdFromGpuAndOutputId>()( gpuHandle, outputId, out var display); if (status != Status.Ok) { throw new NVIDIAApiException(status); } return(display); }
public DemoOutput(OutputId id) { this.Id = id; this.State = IOState.Off; }
public void Clean(OutputId id) { SetCursorPosition(id.Left, CursorTop); Write("".PadRight(id.Length)); SetCursorPosition(id.Left, CursorTop); }
/// <summary> /// Thus function sets the EDID data for the specified GPU handle and connection bit mask. /// User can either send (Gpu handle and output id) or only display Id in variable outputId parameter and gpuHandle /// parameter can be default handle. /// Note: The EDID will be cached across the boot session and will be enumerated to the OS in this call. To remove the /// EDID set size of EDID to zero. OS and NVAPI connection status APIs will reflect the newly set or removed EDID /// dynamically. /// This feature will NOT be supported on the following boards: GeForce, Quadro VX, Tesla /// </summary> /// <param name="gpuHandle">Physical GPU handle to check outputs</param> /// <param name="outputId">Output identification</param> /// <param name="edid">EDID information</param> /// <exception cref="NVIDIANotSupportedException">This operation is not supported.</exception> /// <exception cref="NVIDIAApiException"> /// Status.InvalidArgument: gpuHandle or edid is invalid, outputId has 0 or > 1 bits /// set /// </exception> /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found.</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle.</exception> /// <exception cref="NVIDIAApiException">Status.NotSupported: For the above mentioned GPUs</exception> public static void SetEDID(PhysicalGPUHandle gpuHandle, OutputId outputId, IEDID edid) { SetEDID(gpuHandle, (uint)outputId, edid); }
/// <summary> /// This function returns the output type. User can either specify both 'physical GPU handle and outputId (exactly 1 /// bit set)' or a valid displayId in the outputId parameter. /// </summary> /// <param name="gpuHandle">GPU handle to get information about</param> /// <param name="outputId">Output identification of the output to get information about</param> /// <returns>Type of the output</returns> /// <exception cref="NVIDIAApiException">Status.InvalidArgument: gpuHandle is NULL</exception> /// <exception cref="NVIDIAApiException">Status.NvidiaDeviceNotFound: No NVIDIA GPU driving a display was found</exception> /// <exception cref="NVIDIAApiException">Status.ExpectedPhysicalGPUHandle: gpuHandle was not a physical GPU handle</exception> public static OutputType GetOutputType(PhysicalGPUHandle gpuHandle, OutputId outputId) { return(GetOutputType(gpuHandle, (uint)outputId)); }
internal GPUOutput(OutputId outputId, PhysicalGPUHandle gpuHandle) { OutputId = outputId; OutputType = !gpuHandle.IsNull ? GPUApi.GetOutputType(gpuHandle, outputId) : OutputType.Unknown; PhysicalGPU = new PhysicalGPU(gpuHandle); }
internal GPUOutput(OutputId outputId, PhysicalGPU gpu) : this(outputId, gpu?.Handle ?? PhysicalGPUHandle.DefaultHandle) { PhysicalGPU = gpu; }
/// <summary>Demo method to manualy toggle the input. Normaly done by HW and read by state machine</summary> /// <param name="id">The output id</param> public void ToggleIO(OutputId id) { this.outputs.SetState(id, this.outputs.GetState(id) == IOState.On ? IOState.Off : IOState.On); }
/// <summary> /// Creates a new instance of this class using a OutputId /// </summary> /// <param name="outputId">The output identification of a display or an output</param> public HUEInformation(OutputId outputId) { _outputId = outputId; }