public VcselDriverViewModel(ICommunication communication, IRegionManager regionManager, IEventAggregator eventAggregator) : base(regionManager, eventAggregator) { this.comm = communication; this.vcselDriver = new ConfigVcselDriver(); ConfigVcselDriverCmd = new DelegateCommand(ConfigVcselDriver); eventAggregator.GetEvent <ConfigVcselDriverReplyEvent>().Subscribe(reply => { if (reply.Ack == 0) { this.PrintWatchLog("ConfigVcselDriver Success", LogLevel.Warning); } else { this.PrintWatchLog("ConfigVcselDriver Fail", LogLevel.Error); } MaxIBias = (UInt32)(Math.Round(reply.MaxIBiasMicroAmp / 1000.0 / TickFrequency) * TickFrequency); MaxISw = (UInt32)(Math.Round(reply.MaxISwitchMicroAmp / 1000.0 / TickFrequency) * TickFrequency); IBias = (UInt32)(Math.Round(reply.IBiasMicroAmp / 1000.0 / TickFrequency) * TickFrequency); ISw = (UInt32)(Math.Round(reply.ISwitchMicroAmp / 1000.0 / TickFrequency) * TickFrequency); }, true); }
public bool?ConfigVcselDriver(ConfigVcselDriver vcselDriver) { if (null == client) { return(false); } ConfigVcselDriverRequest msg = new ConfigVcselDriverRequest() { VcselDriver = vcselDriver, }; return(client.Send(msg) > 0); }