private EPGEntry findEPGEntry(EITEntry eitEntry) { foreach (EPGEntry epgEntry in epgDatabase.EPGCollection) { if (epgEntry.OriginalNetworkID == eitEntry.OriginalNetworkID && epgEntry.TransportStreamID == eitEntry.TransportStreamID && epgEntry.ServiceID == eitEntry.ServiceID && epgEntry.StartTime == eitEntry.StartTime) { return(epgEntry); } } return(null); }
private void updateEPGEntry(EPGEntry epgEntry, EITEntry eitEntry) { epgEntry.ComponentTypeAudio = eitEntry.ComponentTypeAudio; epgEntry.ComponentTypeVideo = eitEntry.ComponentTypeVideo; epgEntry.ContentSubType = eitEntry.ContentSubType; epgEntry.ContentType = eitEntry.ContentType; epgEntry.Duration = eitEntry.Duration; epgEntry.EventID = eitEntry.EventID; epgEntry.EventName = eitEntry.EventName; epgEntry.ExtendedDescription = eitEntry.ExtendedDescription; epgEntry.ParentalRating = eitEntry.ParentalRating; epgEntry.RunningStatus = eitEntry.RunningStatus; epgEntry.Scrambled = eitEntry.Scrambled; epgEntry.ShortDescription = eitEntry.ShortDescription; epgEntry.VersionNumber = eitEntry.VersionNumber; }
private void addEPGEntry(EITEntry eitEntry) { EPGEntry epgEntry = new EPGEntry(); epgEntry.ComponentTypeAudio = eitEntry.ComponentTypeAudio; epgEntry.ComponentTypeVideo = eitEntry.ComponentTypeVideo; epgEntry.ContentSubType = eitEntry.ContentSubType; epgEntry.ContentType = eitEntry.ContentType; epgEntry.Duration = eitEntry.Duration; epgEntry.EventID = eitEntry.EventID; epgEntry.EventName = eitEntry.EventName; epgEntry.ExtendedDescription = eitEntry.ExtendedDescription; epgEntry.OriginalNetworkID = eitEntry.OriginalNetworkID; epgEntry.ParentalRating = eitEntry.ParentalRating; epgEntry.RunningStatus = eitEntry.RunningStatus; epgEntry.Scrambled = eitEntry.Scrambled; epgEntry.ServiceID = eitEntry.ServiceID; epgEntry.ShortDescription = eitEntry.ShortDescription; epgEntry.StartTime = eitEntry.StartTime; epgEntry.TransportStreamID = eitEntry.TransportStreamID; epgEntry.VersionNumber = eitEntry.VersionNumber; epgDatabase.AddEPGEntry(epgEntry); }
private async Task <List <EITEntry> > WriteEITData(AcquisitionProtocolParameters parameters, KamaAcquisitionFile file, int loop, int sleepsBetweenWritesMilliseconds) { var result = await Task.Factory.StartNew(() => { Random random = new Random(); List <ElectrodeFrame> samples = new List <ElectrodeFrame>(); for (int index = 0; index < loop; index++) { ElectrodeFrame frame = new ElectrodeFrame(); frame.ComplexCurrentMatrix = Enumerable.Range(0, 2441) .Select(i => ((float)random.NextDouble(), (float)random.NextDouble())).ToArray(); frame.ComplexVoltageMatrix = Enumerable.Range(0, 2441) .Select(i => ((float)random.NextDouble(), (float)random.NextDouble())).ToArray(); frame.PacketId = (ulong)index; var timestamp = DateTimeOffset.Now; frame.timestamp = timestamp.ToUnixTimeMilliseconds(); ulong saturationMask = (ulong)random.Next(); saturationMask = (saturationMask << 32); saturationMask = saturationMask | (ulong)random.Next(); frame.SaturationMask = saturationMask; Thread.Sleep(sleepsBetweenWritesMilliseconds); file.AppendElectrodeSample(frame); samples.Add(frame); } EITEntry entry = new EITEntry { Configuration = parameters.AsJson(), StartDateTime = DateTimeOffset.FromUnixTimeMilliseconds(samples.First().timestamp).DateTime, EndDateTime = DateTimeOffset.FromUnixTimeMilliseconds(samples.Last().timestamp).DateTime, VoltagesReal = new float[samples.Count, samples[0].ComplexVoltageMatrix.Length], VoltagesIm = new float[samples.Count, samples[0].ComplexVoltageMatrix.Length], CurrentsIm = new float[samples.Count, samples[0].ComplexVoltageMatrix.Length], CurrentsReal = new float[samples.Count, samples[0].ComplexVoltageMatrix.Length], Saturation = new ulong[samples.Count, 1], Timestamps = new long[samples.Count, 1] }; for (var i = 0; i < samples.Count; i++) { ElectrodeFrame electrodeFrame = samples[i]; for (int j = 0; j < electrodeFrame.ComplexVoltageMatrix.Length; j++) { entry.VoltagesReal[i, j] = electrodeFrame.ComplexVoltageMatrix[j].Re; entry.VoltagesIm[i, j] = electrodeFrame.ComplexVoltageMatrix[j].Im; } for (int j = 0; j < electrodeFrame.ComplexCurrentMatrix.Length; j++) { entry.CurrentsReal[i, j] = electrodeFrame.ComplexCurrentMatrix[j].Re; entry.CurrentsIm[i, j] = electrodeFrame.ComplexCurrentMatrix[j].Im; } entry.Saturation[i, 0] = electrodeFrame.SaturationMask; entry.Timestamps[i, 0] = electrodeFrame.timestamp; } return(entry); }); return(new List <EITEntry> { result }); }
private EPGEntry findEPGEntry(EITEntry eitEntry) { foreach (EPGEntry epgEntry in epgDatabase.EPGCollection) { if (epgEntry.OriginalNetworkID == eitEntry.OriginalNetworkID && epgEntry.TransportStreamID == eitEntry.TransportStreamID && epgEntry.ServiceID == eitEntry.ServiceID && epgEntry.StartTime == eitEntry.StartTime) return (epgEntry); } return (null); }