public async Task <bool> TimestampIsEqual() { //no timestamp has ever been written, so we dont know if (DataModel.TimeStampWrittenToEsc == 0) { return(false); } var z = new GetE2PromExt(Id, 8, McuDat.DesignTimestamp); var sem = new AutoResetEvent(false); CommunicationViewModel.AddData(z); await z.WaitAsync(); Timestamp = BitConverter.ToInt64(z.ReceivedEpromValues.ToArray(), 0); var ret = Timestamp == DataModel.TimeStampWrittenToEsc; sem.Set(); z.Error += (p, q) => sem.Set(); CommunicationViewModel.AddData(z); sem.WaitOne(2000); return(ret); }
private void UpdateEepromData(GetE2PromExt data) { var arr = data.ReceivedEpromValues.ToArray(); for (var n = 0; n < arr.Length; n++) { _dspCopy[n + data.StartAddress] = arr[n]; } }
public async Task GetEeprom(IProgress <DownloadProgress> iProgress) { _eepromReceivePackages[_area] = 0; var ar = McuDat.EepromAreaFactory(_area); var count = ar.Size / McuDat.BufferSize + 1; for (var i = ar.Location; i < ar.Location + ar.Size + McuDat.BufferSize; i += McuDat.BufferSize) { var s = new GetE2PromExt(_mcuid, McuDat.BufferSize, i); CommunicationViewModel.AddData(s); await s.WaitAsync(); UpdateEepromData(s); iProgress.Report(new DownloadEeprom() { Progress = ++_eepromReceivePackages[_area], Total = count, Area = _area }); } }