예제 #1
0
 private void HardwareAdded(IHardware hardware)
 {
     if (supportedHw.Contains(hardware.HardwareType))
     {
         Execute.OnUIThreadAsync(() => Hardware.Add(new HardwareItemViewModel(hardware, this)));
     }
 }
예제 #2
0
        public override bool InitializeHardware()
        {
            Logger.Debug("Initializing hardware ...");

            if (NvApi.NvApiEnumPhysicalGpUs == null || NvApi.NvApiGetPhysicalGpUsFromDisplay == null || NvApi.NvApiEnumNvidiaDisplayHandle == null)
            {
                Logger.Debug("Unable to init hardware, NvApiEnumPhysicalGpUs, NvApiEnumNvidiaDisplayHandle and NvApiGetPhysicalGpUsFromDisplay are null pointer");
                return(false);
            }

            NvStatus status;
            var      handles = new NvPhysicalGpuHandle[NvApi.MaxPhysicalGpus];

            if ((status = NvApi.NvApiEnumPhysicalGpUs(handles, out var gpuCount)) != NvStatus.Ok)
            {
                Logger.Error($"Unable to enumerate physical gpus, the API status is: {status}");
                return(false);
            }

            for (var gpuIndex = 0; gpuIndex < gpuCount; gpuIndex++)
            {
                var ngpu = new NVidiaGpu(gpuIndex, handles[gpuIndex]);
                Logger.Debug($"Adding GPU {ngpu}");
                ngpu.InitializeSensors();
                Hardware.Add(ngpu);
            }

            return(true);
        }
예제 #3
0
 /// <summary>
 /// <p>Adds hardware that can be supported with this specific module.</p>
 /// <p>Hardware can't be removed from this list, use <see cref="InitializeHardware"/> to prevent module loading</p>
 /// </summary>
 /// <param name="hardware">Reference on adding hardware</param>
 public void AddHardware(IHardware hardware)
 {
     Hardware.Add(hardware);
 }