Example #1
0
 public void Assign(DeviceDescriptor source)
 {
     this.Kind = source.Kind;
     this.RelativeIndex = source.RelativeIndex;
     this.Driver = source.Driver;
     this.Path = source.Path;
     this.Serial = source.Serial;
 }
 public void Assign(DeviceDescriptor source)
 {
     Kind = source.Kind;
     RelativeIndex = source.RelativeIndex;
     Driver = source.Driver;
     Path = source.Path;
     Serial = source.Serial;
 }
Example #3
0
 public void SetDevicesToCoin(string signature, DeviceDescriptor[] devices, string coinSymbol)
 {
     ApplicationProxy.Instance.SetDevicesToCoin(this, GetClientIpAddress(), signature, devices, coinSymbol);
 }
Example #4
0
 public void ToggleDevices(string signature, DeviceDescriptor[] devices, bool enabled)
 {
     ApplicationProxy.Instance.ToggleDevices(this, GetClientIpAddress(), signature, devices, enabled);
 }
        public DeviceViewModel ApplyDeviceInformationResponseModel(DeviceDescriptor deviceModel, DeviceInformation deviceInformationResponseModel)
        {
            string[] excludedProperties = 
            { 
                "Name",     //don't overwrite our "nice" name
                "Kind",     //we have our own enum Kind
                "Enabled"   //don't overwrite our own Enabled flag
            };

            DeviceViewModel deviceViewModel = Devices.SingleOrDefault(d => d.Equals(deviceModel));
            if (deviceViewModel != null)
            {
                if ((deviceModel.Kind == DeviceKind.PXY) || (deviceModel.Kind == DeviceKind.NET))
                {
                    deviceViewModel.PoolIndex = deviceInformationResponseModel.PoolIndex;

                    //we will get multiple deviceInformationResponseModels for the same deviceModel in the case of a Stratum Proxy
                    //bfgminer will report back for each Proxy Worker, but we only show a single entry in the ViewModel that rolls
                    //up the stats for individual Proxy Workers
                    deviceViewModel.AverageHashrate += deviceInformationResponseModel.AverageHashrate;
                    deviceViewModel.CurrentHashrate += deviceInformationResponseModel.CurrentHashrate;
                    deviceViewModel.AcceptedShares += deviceInformationResponseModel.AcceptedShares;
                    deviceViewModel.RejectedShares += deviceInformationResponseModel.RejectedShares;
                    deviceViewModel.HardwareErrors += deviceInformationResponseModel.HardwareErrors;
                    deviceViewModel.Utility += deviceInformationResponseModel.Utility;
                    deviceViewModel.WorkUtility += deviceInformationResponseModel.WorkUtility;

                    //now add as a worker
                    DeviceViewModel workerViewModel = new DeviceViewModel();
                    ObjectCopier.CopyObject(deviceInformationResponseModel, workerViewModel, excludedProperties);
                    workerViewModel.WorkerName = deviceInformationResponseModel.Name; //set a default until (if) we get details
                    deviceViewModel.Workers.Add(workerViewModel);

                    //recalculate hardware and rejected share percentages - need to be weighted with worker hashrates
                    UpdatePercentagesBasedOnWorkers(deviceViewModel);
                }
                else
                {
                    ObjectCopier.CopyObject(deviceInformationResponseModel, deviceViewModel, excludedProperties);
                }
            }
            return deviceViewModel;
        }