public async Task ExposureNotDetectedAsync(ExposureConfiguration exposureConfiguration) { Logger.D($"ExposureNotDetected: {DateTime.UtcNow}"); var enVersion = (await EnClient.GetVersionAsync()).ToString(); var exposureResult = new ExposureResult( exposureConfiguration, DateTime.Now ) { Device = DeviceInfo.Model, EnVersion = enVersion }; var filePath = await SaveExposureResult(exposureResult); var exposureDataServerConfiguration = await LoadExposureDataServerConfiguration(); var exposureDataResponse = await new ExposureDataServer(exposureDataServerConfiguration).UploadExposureDataAsync( exposureConfiguration, DeviceInfo.Model, enVersion ); if (exposureDataResponse != null) { await SaveExposureResult(exposureDataResponse); File.Delete(filePath); } }
public async Task ExposureDetectedAsync(ExposureSummary exposureSummary, IList <ExposureInformation> exposureInformations, ExposureConfiguration exposureConfiguration) { Logger.D($"ExposureDetected V1: {DateTime.UtcNow}"); var enVersion = (await ExposureNotificationClientManager.Shared.GetVersionAsync()).ToString(); var exposureResult = new ExposureResult( exposureConfiguration, DateTime.Now, exposureSummary, exposureInformations ) { Device = DeviceInfo.Model, EnVersion = enVersion }; var filePath = await SaveExposureResult(exposureResult); var exposureDataServerConfiguration = await LoadExposureDataServerConfiguration(); var exposureDataResponse = await new ExposureDataServer(exposureDataServerConfiguration).UploadExposureDataAsync( exposureConfiguration, DeviceInfo.Model, enVersion, exposureSummary, exposureInformations ); if (exposureDataResponse != null) { await SaveExposureResult(exposureDataResponse); File.Delete(filePath); } }
private async Task <string> SaveExposureResult(ExposureResult exposureResult) { string fileName = $"exposuredata-{exposureResult.GetHashCode()}.json"; string json = exposureResult.ToJsonString(); var filePath = Path.Combine(_exposureDetectionResultDir, fileName); await File.WriteAllTextAsync(filePath, json); return(filePath); }
public void ExposureNotDetected() { D.Print("# ExposureNotDetected"); var exposureResult = new ExposureResult(GetEnClient().ExposureConfiguration, DateTime.Now); _ = Task.Run(async() => await Utils.SaveExposureResult( exposureResult, (await GetEnClient().GetVersionAsync()).ToString(), _exposureDetectionResultDir) ); }
public void ExposureDetected(IList <IDailySummary> dailySummaries, IList <IExposureWindow> exposureWindows) { D.Print("# ExposureDetected ExposureWindow"); var exposureResult = new ExposureResult(GetEnClient().ExposureConfiguration, DateTime.Now, dailySummaries, exposureWindows); _ = Task.Run(async() => await Utils.SaveExposureResult( exposureResult, (await GetEnClient().GetVersionAsync()).ToString(), _exposureDetectionResultDir) ); }
public void ExposureDetected(IExposureSummary exposureSummary, IList <IExposureInformation> exposureInformations) { D.Print("# ExposureDetected ExposureInformation"); var exposureResult = new ExposureResult(GetEnClient().ExposureConfiguration, DateTime.Now, exposureSummary, exposureInformations); _ = Task.Run(async() => await Utils.SaveExposureResult( exposureResult, (await GetEnClient().GetVersionAsync()).ToString(), _exposureDetectionResultDir) ); }
public static async Task SaveExposureResult(ExposureResult exposureResult, string version, string outputDir) { exposureResult.Device = DeviceInfo.Model; exposureResult.EnVersion = version; string fileName = $"{exposureResult.Id}.json"; var filePath = Path.Combine(outputDir, fileName); string json = exposureResult.ToJsonString(); D.Print(json); await File.WriteAllTextAsync(filePath, json); }
public void Subscribe(ExposureResult value) { _exposureResultSubject.OnNext(value); }