Beispiel #1
0
        protected override void SetChannel(Channel channel)
        {
            if (channel == null)
            {
                throw new ArgumentNullException("channel");
            }

            ITuneRequest tuneRequest;
            int          hr = tuningSpace.CreateTuneRequest(out tuneRequest);

            DsError.ThrowExceptionForHR(hr);

            IATSCChannelTuneRequest atscRequest = (IATSCChannelTuneRequest)tuneRequest;

            IATSCLocator locator = (IATSCLocator) new ATSCLocator();

            locator.put_CarrierFrequency(channel.CarrierFrequency);
            locator.put_PhysicalChannel(channel.PhysicalChannel);


            atscRequest.put_Locator(locator);
            atscRequest.put_Channel(channel.MajorChannel);
            atscRequest.put_MinorChannel(channel.MinorChannel);

            hr = tuner.put_TuneRequest(atscRequest);
            DsError.ThrowExceptionForHR(hr);

            ReleaseComObject(tuneRequest);
        }
        private void TestCreateTuneRequest()
        {
            int          hr = 0;
            ITuneRequest tuneReq;

            hr = tuningSpace.CreateTuneRequest(out tuneReq);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert((hr == 0) && (tuneReq != null), "ITuningSpace.CreateTuneRequest");

            // ATSC tuning spaces create ATSC tune request...
            Debug.Assert(tuneReq is IATSCChannelTuneRequest, "ITuningSpace.CreateTuneRequest");

            Marshal.ReleaseComObject(tuneReq);
        }
Beispiel #3
0
        public static ITuneRequest CreateTuneRequest(ITuningSpace ts)
        {
            int          hr = 0;
            ITuneRequest tr = null;
            Guid         networkType;

            hr = ts.CreateTuneRequest(out tr);
            DsError.ThrowExceptionForHR(hr);

            hr = ts.get__NetworkType(out networkType);

            if (networkType == typeof(ATSCNetworkProvider).GUID)
            {
                // I know nothing about ATSC so thoses lines are pure speculation
                hr = (tr as IATSCChannelTuneRequest).put_Channel(-1);

                IATSCLocator locator = (IATSCLocator) new ATSCLocator();
                hr = locator.put_CarrierFrequency(-1);
                hr = tr.put_Locator(locator as ILocator);
            }
            else if (networkType == typeof(DVBTNetworkProvider).GUID)
            {
                hr = (tr as IDVBTuneRequest).put_ONID(-1);
                hr = (tr as IDVBTuneRequest).put_TSID(-1);
                hr = (tr as IDVBTuneRequest).put_SID(-1);

                IDVBTLocator locator = (IDVBTLocator) new DVBTLocator();
                hr = locator.put_CarrierFrequency(-1);
                hr = tr.put_Locator(locator as ILocator);
            }
            else if (networkType == typeof(DVBSNetworkProvider).GUID)
            {
                hr = (tr as IDVBTuneRequest).put_ONID(-1);
                hr = (tr as IDVBTuneRequest).put_TSID(-1);
                hr = (tr as IDVBTuneRequest).put_SID(-1);

                IDVBSLocator locator = (IDVBSLocator) new DVBSLocator();
                hr = locator.put_CarrierFrequency(-1);
                hr = locator.put_SymbolRate(-1);
                hr = tr.put_Locator(locator as ILocator);
            }

            return(tr);
        }
Beispiel #4
0
        public void UpdateService(string serviceId, ITuningSpace tuningSpace, IGuideData guideData)
        {
            Trace.WriteLineIf(trace.TraceInfo, "EPG.UpdateService(" + serviceId + ")");
            if (serviceId == null)
            {
                UpdateAllService(guideData);
            }
            else if (tuningSpace != null && NeedServiceUpdate(serviceId))
            {
                // serviceId = "ONID:TSID:SID"
                string[] serviceIds = serviceId.Split(new char[] { ':' });
                int      onid       = int.Parse(serviceIds[0]);
                int      tsid       = int.Parse(serviceIds[1]);
                int      sid        = int.Parse(serviceIds[2]);

                ITuneRequest tr;
                tuningSpace.CreateTuneRequest(out tr);
                IDVBTuneRequest tuneRequest = (IDVBTuneRequest)tr;
                tuneRequest.put_ONID(onid);
                tuneRequest.put_TSID(tsid);
                tuneRequest.put_SID(sid);
                UpdateService(tuneRequest, guideData);
            }
        }
Beispiel #5
0
        public void UpdateService(string serviceId, ITuningSpace tuningSpace, IGuideData guideData)
        {
            Trace.WriteLineIf(trace.TraceInfo, "EPG.UpdateService(" + serviceId + ")");
            if (serviceId == null)
                UpdateAllService(guideData);
            else if (tuningSpace != null && NeedServiceUpdate(serviceId))
            {
                // serviceId = "ONID:TSID:SID"
                string[] serviceIds = serviceId.Split(new char[] { ':' });
                int onid = int.Parse(serviceIds[0]);
                int tsid = int.Parse(serviceIds[1]);
                int sid = int.Parse(serviceIds[2]);

                ITuneRequest tr;
                tuningSpace.CreateTuneRequest(out tr);
                IDVBTuneRequest tuneRequest = (IDVBTuneRequest)tr;
                tuneRequest.put_ONID(onid);
                tuneRequest.put_TSID(tsid);
                tuneRequest.put_SID(sid);
                UpdateService(tuneRequest, guideData);
            }
        }
Beispiel #6
0
        private void createTuneRequest(ITuningSpace tuningSpace, TuningSpec tuningSpec)
        {
            reply = tuningSpace.CreateTuneRequest(out tuneRequest);
            DsError.ThrowExceptionForHR(reply);

            if (tuningSpec.Frequency.TunerType == TunerType.Satellite ||
                tuningSpec.Frequency.TunerType == TunerType.Terrestrial ||
                tuningSpec.Frequency.TunerType == TunerType.Cable)
            {
                LogMessage("Creating DVB tune request");

                reply = ((IDVBTuneRequest)tuneRequest).put_ONID(-1);
                DsError.ThrowExceptionForHR(reply);

                reply = ((IDVBTuneRequest)tuneRequest).put_TSID(-1);
                DsError.ThrowExceptionForHR(reply);

                reply = ((IDVBTuneRequest)tuneRequest).put_SID(-1);
                DsError.ThrowExceptionForHR(reply);
            }
            else
            {
                if (tuningSpec.Frequency.TunerType == TunerType.ATSC || tuningSpec.Frequency.TunerType == TunerType.ATSCCable)
                {
                    LogMessage("Creating ATSC tune request");

                    reply = ((IATSCChannelTuneRequest)tuneRequest).put_Channel(-1);
                    DsError.ThrowExceptionForHR(reply);

                    reply = ((IATSCChannelTuneRequest)tuneRequest).put_MinorChannel(-1);
                    DsError.ThrowExceptionForHR(reply);
                }
                else
                {
                    if (tuningSpec.Frequency.TunerType == TunerType.ClearQAM)
                    {
                        LogMessage("Creating Clear QAM tune request");

                        reply = ((IDigitalCableTuneRequest)tuneRequest).put_Channel(-1);
                        DsError.ThrowExceptionForHR(reply);

                        reply = ((IDigitalCableTuneRequest)tuneRequest).put_MinorChannel(-1);
                        DsError.ThrowExceptionForHR(reply);
                    }
                    else
                    {
                        if (tuningSpec.Frequency.TunerType == TunerType.ISDBS ||
                            tuningSpec.Frequency.TunerType == TunerType.ISDBT)
                        {
                            LogMessage("Creating ISDB tune request");

                            reply = ((IDVBTuneRequest)tuneRequest).put_ONID(-1);
                            DsError.ThrowExceptionForHR(reply);

                            reply = ((IDVBTuneRequest)tuneRequest).put_TSID(-1);
                            DsError.ThrowExceptionForHR(reply);

                            reply = ((IDVBTuneRequest)tuneRequest).put_SID(-1);
                            DsError.ThrowExceptionForHR(reply);
                        }
                    }
                }
            }

            reply = tuneRequest.put_Locator(getLocator(tuningSpec));
            DsError.ThrowExceptionForHR(reply);
        }