/// <summary> /// Sends the diseq command. /// </summary> /// <param name="channel">The channel.</param> /// <param name="parameters">The scanparameters.</param> public void SendDiseqCommand(ScanParameters parameters, DVBSChannel channel) { if (m_bIsTeVii == false) { return; } Log.Log.Debug("TeVii: SendDiseqc: {0},{1}", parameters.ToString(), channel.ToString()); //bit 0 (1) : 0=low band, 1 = hi band //bit 1 (2) : 0=vertical, 1 = horizontal //bit 3 (4) : 0=satellite position A, 1=satellite position B //bit 4 (8) : 0=switch option A, 1=switch option B // LNB option position // 1 A A // 2 A B // 3 B A // 4 B B int antennaNr = BandTypeConverter.GetAntennaNr(channel); bool hiBand = BandTypeConverter.IsHiBand(channel, parameters); bool isHorizontal = ((channel.Polarisation == Polarisation.LinearH) || (channel.Polarisation == Polarisation.CircularL)); byte cmd = 0xf0; cmd |= (byte)(hiBand ? 1 : 0); cmd |= (byte)((isHorizontal) ? 2 : 0); cmd |= (byte)((antennaNr - 1) << 2); byte[] ucMessage = new byte[4]; ucMessage[0] = 0xE0; //framing byte ucMessage[1] = 0x10; //address byte ucMessage[2] = 0x38; //command byte ucMessage[3] = cmd; //data byte (port group 0) //byte[] ucMessage = DiSEqC_Helper.ChannelToDiSEqC(parameters, channel); SendDiSEqCCommand(ucMessage); }
/// <summary> /// Sends the diseq command. /// </summary> /// <param name="channel">The channel.</param> /// <param name="parameters">The channels scanning parameters.</param> public void SendDiseqCommand(ScanParameters parameters, DVBSChannel channel) { if (_isGenPix == false) { return; } Log.Log.Debug("SendDiseqc: {0},{1}", parameters.ToString(), channel.ToString()); //bit 0 (1) : 0=low band, 1 = hi band //bit 1 (2) : 0=vertical, 1 = horizontal //bit 3 (4) : 0=satellite position A, 1=satellite position B //bit 4 (8) : 0=switch option A, 1=switch option B // LNB option position // 1 A A // 2 A B // 3 B A // 4 B B int antennaNr = BandTypeConverter.GetAntennaNr(channel); bool hiBand = BandTypeConverter.IsHiBand(channel, parameters); bool isHorizontal = ((channel.Polarisation == Polarisation.LinearH) || (channel.Polarisation == Polarisation.CircularL)); byte cmd = 0xf0; cmd |= (byte)(hiBand ? 1 : 0); cmd |= (byte)((isHorizontal) ? 2 : 0); cmd |= (byte)((antennaNr - 1) << 2); DISEQC_COMMAND DiseqcCommand = new DISEQC_COMMAND(); DiseqcCommand.ucMessage[0] = 0xE0; //framing byte DiseqcCommand.ucMessage[1] = 0x10; //address byte DiseqcCommand.ucMessage[2] = 0x38; //command byte DiseqcCommand.ucMessage[3] = cmd; //data byte (port group 0) DiseqcCommand.ucMessage[4] = 0; //Need not fill this up DiseqcCommand.ucMessage[5] = 0; //Need not fill this up DiseqcCommand.ucMessageLength = 4; //Number of Valid bytes in the Command. Marshal.StructureToPtr(DiseqcCommand, _ptrDiseqc, false); //get the length of the structure command - usually 7 bytes. int len = Marshal.SizeOf(DiseqcCommand); string txt = ""; for (int i = 0; i < len; ++i) { txt += String.Format("0x{0:X} ", Marshal.ReadByte(_ptrDiseqc, i)); } Log.Log.Debug("GenPix: SendDiseqCommand: {0} with length {1}", txt, len); //set the DisEqC command to the tuner pin int hr = _propertySet.Set(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, _ptrTempInstance, 32, _ptrDiseqc, len); if (hr != 0) { Log.Log.Info("GenPix: SendDiseqCommand returned: 0x{0:X} - {1}{2}", hr, HResult.GetDXErrorString(hr), DsError.GetErrorText(hr)); } }
/// <summary> /// Sends the diseq command. /// </summary> /// <param name="parameters">Scan parameters</param> /// <param name="channel">The channel.</param> public void SendDiseqCommand(ScanParameters parameters, DVBSChannel channel) { byte disEqcPort = (byte)BandTypeConverter.GetAntennaNr(channel); Int32 LNBLOFLowBand; Int32 LNBLOFHighBand; Int32 LNBLOFHiLoSW; BandTypeConverter.GetDefaultLnbSetup(parameters, channel.BandType, out LNBLOFLowBand, out LNBLOFHighBand, out LNBLOFHiLoSW); byte turnon22Khz = BandTypeConverter.IsHiBand(channel, parameters) ? (byte)2 : (byte)1; SetLnbData(true, LNBLOFLowBand, LNBLOFHighBand, LNBLOFHiLoSW, turnon22Khz, disEqcPort); SendDiseqcCommandTest(parameters, channel); }
/// <summary> /// Tunes to channel using custom tune method. /// </summary> /// <param name="channel">Channel</param> /// <param name="Parameters">ScanParameters</param> /// <returns>true if successful</returns> public bool CustomTune(IChannel channel, ScanParameters Parameters) { if (!SupportsTuningForChannel(channel)) { return(false); } DVBSChannel satelliteChannel = channel as DVBSChannel; bool hiBand = BandTypeConverter.IsHiBand(satelliteChannel, Parameters); int lof1, lof2, sw; BandTypeConverter.GetDefaultLnbSetup(Parameters, satelliteChannel.BandType, out lof1, out lof2, out sw); int lnbFrequency; if (hiBand) { lnbFrequency = lof2 * 1000; } else { lnbFrequency = lof1 * 1000; } Log.Log.Debug("TeVii: Start CustomTune F:{0} SR:{1} LOF:{6} P:{2} HI:{3} M:{4} FEC:{5}", (int)satelliteChannel.Frequency, satelliteChannel.SymbolRate * 1000, Translate(satelliteChannel.Polarisation), hiBand, Translate(satelliteChannel.ModulationType), Translate(satelliteChannel.InnerFecRate), lnbFrequency ); int res = TuneTransponder(m_iDeviceIndex, (int)satelliteChannel.Frequency, satelliteChannel.SymbolRate * 1000, lnbFrequency, Translate(satelliteChannel.Polarisation), hiBand ? 1 : 0, Translate(satelliteChannel.ModulationType), Translate(satelliteChannel.InnerFecRate) ); Log.Log.Debug("TeVii: Send CustomTune: {0}", res); return(res == 1); }
///<summary> /// Send DiseqC Command test ///</summary> ///<param name="parameters">Scan parameters</param> ///<param name="channel">Channel</param> public void SendDiseqcCommandTest(ScanParameters parameters, DVBSChannel channel) { int antennaNr = BandTypeConverter.GetAntennaNr(channel); bool hiBand = BandTypeConverter.IsHiBand(channel, parameters); bool isHorizontal = ((channel.Polarisation == Polarisation.LinearH) || (channel.Polarisation == Polarisation.CircularL)); byte cmd = 0xf0; cmd |= (byte)(hiBand ? 1 : 0); cmd |= (byte)((isHorizontal) ? 2 : 0); cmd |= (byte)((antennaNr - 1) << 2); byte[] diseqc = new byte[4]; diseqc[0] = 0xe0; diseqc[1] = 0x10; diseqc[2] = 0x38; diseqc[3] = cmd; SendDiSEqCCommand(diseqc); }
private bool BeforeTune(IChannel channel, ref int subChannelId, out int pmtPid) { int frequency = 0; int symbolRate = 0; int modulation = (int)eModulationTAG.QAM_64; int bandWidth = 0; LNBSelectionType lnbSelection = LNBSelectionType.Lnb0; const int lnbKhzTone = 22; const int fec = (int)FecType.Fec_Auto; int polarity = 0; SS2DisEqcType disType = SS2DisEqcType.None; int switchFreq = 0; pmtPid = 0; int satelliteIndex = 0; Log.Log.WriteFile("ss2:Tune({0})", channel); if (_epgGrabbing) { _epgGrabbing = false; if (_epgGrabberCallback != null && _epgGrabbing) { _epgGrabberCallback.OnEpgCancelled(); } } switch (_cardType) { case CardType.DvbS: DVBSChannel dvbsChannel = channel as DVBSChannel; if (dvbsChannel == null) { Log.Log.Error("Channel is not a DVBS channel!!! {0}", channel.GetType().ToString()); return(false); } if (CurrentChannel != null) { DVBSChannel oldChannels = (DVBSChannel)CurrentChannel; if (oldChannels.Equals(channel)) { //@FIX this fails for back-2-back recordings //Log.Log.WriteFile("ss2:already tuned on this channel"); //return _mapSubChannels[0]; } } frequency = (int)dvbsChannel.Frequency; symbolRate = dvbsChannel.SymbolRate; satelliteIndex = dvbsChannel.SatelliteIndex; bool hiBand = BandTypeConverter.IsHiBand(dvbsChannel, Parameters); int lof1, lof2, sw; BandTypeConverter.GetDefaultLnbSetup(Parameters, dvbsChannel.BandType, out lof1, out lof2, out sw); int lnbFrequency; if (BandTypeConverter.IsHiBand(dvbsChannel, Parameters)) { lnbFrequency = lof2 * 1000; } else { lnbFrequency = lof1 * 1000; } //0=horizontal or left, 1=vertical or right polarity = 0; if (dvbsChannel.Polarisation == Polarisation.LinearV) { polarity = 1; } if (dvbsChannel.Polarisation == Polarisation.CircularR) { polarity = 1; } Log.Log.WriteFile("ss2: Polarity:{0} {1}", dvbsChannel.Polarisation, polarity); lnbSelection = LNBSelectionType.Lnb0; if (dvbsChannel.BandType == BandType.Universal) { //only set the LNB (22,33,44) Khz tone when we use ku-band and are in hi-band switch (lnbKhzTone) { case 22: lnbSelection = LNBSelectionType.Lnb22kHz; break; } if (hiBand == false) { lnbSelection = LNBSelectionType.Lnb0; } } switch (dvbsChannel.DisEqc) { case DisEqcType.None: // none disType = SS2DisEqcType.None; break; case DisEqcType.SimpleA: // Simple A disType = SS2DisEqcType.Simple_A; break; case DisEqcType.SimpleB: // Simple B disType = SS2DisEqcType.Simple_B; break; case DisEqcType.Level1AA: // Level 1 A/A disType = SS2DisEqcType.Level_1_A_A; break; case DisEqcType.Level1BA: // Level 1 B/A disType = SS2DisEqcType.Level_1_B_A; break; case DisEqcType.Level1AB: // Level 1 A/B disType = SS2DisEqcType.Level_1_A_B; break; case DisEqcType.Level1BB: // Level 1 B/B disType = SS2DisEqcType.Level_1_B_B; break; } switchFreq = lnbFrequency / 1000; //in MHz pmtPid = dvbsChannel.PmtPid; break; case CardType.DvbT: DVBTChannel dvbtChannel = channel as DVBTChannel; if (dvbtChannel == null) { Log.Log.Error("Channel is not a DVBT channel!!! {0}", channel.GetType().ToString()); return(false); } if (CurrentChannel != null) { DVBTChannel oldChannelt = (DVBTChannel)CurrentChannel; if (oldChannelt.Equals(channel)) { //@FIX this fails for back-2-back recordings //Log.Log.WriteFile("ss2:already tuned on this channel"); //return _mapSubChannels[0]; } } frequency = (int)dvbtChannel.Frequency; bandWidth = dvbtChannel.BandWidth; pmtPid = dvbtChannel.PmtPid; break; case CardType.DvbC: DVBCChannel dvbcChannel = channel as DVBCChannel; if (dvbcChannel == null) { Log.Log.Error("Channel is not a DVBC channel!!! {0}", channel.GetType().ToString()); return(false); } if (CurrentChannel != null) { DVBCChannel oldChannelc = (DVBCChannel)CurrentChannel; if (oldChannelc.Equals(channel)) { //@FIX this fails for back-2-back recordings //Log.Log.WriteFile("ss2:already tuned on this channel"); //return _mapSubChannels[0]; } } frequency = (int)dvbcChannel.Frequency; symbolRate = dvbcChannel.SymbolRate; switch (dvbcChannel.ModulationType) { case ModulationType.Mod16Qam: modulation = (int)eModulationTAG.QAM_16; break; case ModulationType.Mod32Qam: modulation = (int)eModulationTAG.QAM_32; break; case ModulationType.Mod64Qam: modulation = (int)eModulationTAG.QAM_64; break; case ModulationType.Mod128Qam: modulation = (int)eModulationTAG.QAM_128; break; case ModulationType.Mod256Qam: modulation = (int)eModulationTAG.QAM_256; break; } pmtPid = dvbcChannel.PmtPid; break; case CardType.Atsc: ATSCChannel dvbaChannel = channel as ATSCChannel; if (dvbaChannel == null) { Log.Log.Error("Channel is not a ATSC channel!!! {0}", channel.GetType().ToString()); return(false); } if (CurrentChannel != null) { ATSCChannel oldChannela = (ATSCChannel)CurrentChannel; if (oldChannela.Equals(channel)) { //@FIX this fails for back-2-back recordings //Log.Log.WriteFile("ss2:already tuned on this channel"); //return _mapSubChannels[0]; } } //if modulation = 256QAM assume ATSC QAM for HD5000 if (dvbaChannel.ModulationType == ModulationType.Mod256Qam) { Log.Log.WriteFile("DVBGraphB2C2: ATSC Channel:{0} Frequency:{1}", dvbaChannel.PhysicalChannel, dvbaChannel.Frequency); frequency = (int)dvbaChannel.Frequency; pmtPid = dvbaChannel.PmtPid; } else { Log.Log.WriteFile("DVBGraphSkyStar2: ATSC Channel:{0}", dvbaChannel.PhysicalChannel); //#DM B2C2 SDK says ATSC is tuned by frequency. Here we work the OTA frequency by channel number# int atscfreq = 0; if (dvbaChannel.PhysicalChannel <= 6) { atscfreq = 45 + (dvbaChannel.PhysicalChannel * 6); } if (dvbaChannel.PhysicalChannel >= 7 && dvbaChannel.PhysicalChannel <= 13) { atscfreq = 177 + ((dvbaChannel.PhysicalChannel - 7) * 6); } if (dvbaChannel.PhysicalChannel >= 14) { atscfreq = 473 + ((dvbaChannel.PhysicalChannel - 14) * 6); } //#DM changed tuning parameter from physical channel to calculated frequency above. frequency = atscfreq; Log.Log.WriteFile("ss2: ATSC Frequency:{0} MHz", frequency); pmtPid = dvbaChannel.PmtPid; } break; } if (_graphState == GraphState.Idle) { BuildGraph(); } if (_mapSubChannels.ContainsKey(subChannelId) == false) { subChannelId = GetNewSubChannel(channel); } _mapSubChannels[subChannelId].CurrentChannel = channel; _mapSubChannels[subChannelId].OnBeforeTune(); if (_interfaceEpgGrabber != null) { _interfaceEpgGrabber.Reset(); } if (frequency > 13000) { frequency /= 1000; } Log.Log.WriteFile("ss2: Transponder Frequency:{0} MHz", frequency); int hr = _interfaceB2C2TunerCtrl.SetFrequency(frequency); if (hr != 0) { Log.Log.Error("ss2:SetFrequencyKHz() failed:0x{0:X}", hr); return(false); } switch (_cardType) { case CardType.DvbC: Log.Log.WriteFile("ss2: SymbolRate:{0} KS/s", symbolRate); hr = _interfaceB2C2TunerCtrl.SetSymbolRate(symbolRate); if (hr != 0) { Log.Log.Error("ss2:SetSymbolRate() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: Modulation:{0}", ((eModulationTAG)modulation)); hr = _interfaceB2C2TunerCtrl.SetModulation(modulation); if (hr != 0) { Log.Log.Error("ss2:SetModulation() failed:0x{0:X}", hr); return(false); } break; case CardType.DvbT: Log.Log.WriteFile("ss2: GuardInterval:auto"); hr = _interfaceB2C2TunerCtrl.SetGuardInterval((int)GuardIntervalType.Interval_Auto); if (hr != 0) { Log.Log.Error("ss2:SetGuardInterval() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: Bandwidth:{0} MHz", bandWidth); //hr = _interfaceB2C2TunerCtrl.SetBandwidth((int)dvbtChannel.BandWidth); // Set Channel Bandwidth (NOTE: Temporarily use polarity function to avoid having to // change SDK interface for SetBandwidth) // from Technisat SDK 03/2006 hr = _interfaceB2C2TunerCtrl.SetPolarity(bandWidth); if (hr != 0) { Log.Log.Error("ss2:SetBandwidth() failed:0x{0:X}", hr); return(false); } break; case CardType.DvbS: Log.Log.WriteFile("ss2: SymbolRate:{0} KS/s", symbolRate); hr = _interfaceB2C2TunerCtrl.SetSymbolRate(symbolRate); if (hr != 0) { Log.Log.Error("ss2:SetSymbolRate() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: Fec:{0} {1}", ((FecType)fec), fec); hr = _interfaceB2C2TunerCtrl.SetFec(fec); if (hr != 0) { Log.Log.Error("ss2:SetFec() failed:0x{0:X}", hr); return(false); } hr = _interfaceB2C2TunerCtrl.SetPolarity(polarity); if (hr != 0) { Log.Log.Error("ss2:SetPolarity() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: Lnb:{0}", lnbSelection); hr = _interfaceB2C2TunerCtrl.SetLnbKHz((int)lnbSelection); if (hr != 0) { Log.Log.Error("ss2:SetLnbKHz() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: Diseqc:{0} {1}", disType, disType); hr = _interfaceB2C2TunerCtrl.SetDiseqc((int)disType); if (hr != 0) { Log.Log.Error("ss2:SetDiseqc() failed:0x{0:X}", hr); return(false); } Log.Log.WriteFile("ss2: LNBFrequency:{0} MHz", switchFreq); hr = _interfaceB2C2TunerCtrl.SetLnbFrequency(switchFreq); if (hr != 0) { Log.Log.Error("ss2:SetLnbFrequency() failed:0x{0:X}", hr); return(false); } if (_useDISEqCMotor) { if (satelliteIndex > 0) { DisEqcGotoPosition((byte)satelliteIndex); } } break; } return(true); }
/// <summary> /// Sends the diseq command. /// </summary> /// <param name="channel">The channel.</param> /// <param name="parameters">The scanparameters.</param> public bool SendDiseqCommand(ScanParameters parameters, DVBSChannel channel) { bool succeeded = true; if (_isHauppauge == false) { return(true); } int antennaNr = BandTypeConverter.GetAntennaNr(channel); if (antennaNr == 0) { return(true); } //clear the message params before writing in order to avoid corruption of the diseqc message. for (int i = 0; i < 188; ++i) { Marshal.WriteByte(_ptrDiseqc, i, 0x00); } bool hiBand = BandTypeConverter.IsHiBand(channel, parameters); //bit 0 (1) : 0=low band, 1 = hi band //bit 1 (2) : 0=vertical, 1 = horizontal //bit 3 (4) : 0=satellite position A, 1=satellite position B //bit 4 (8) : 0=switch option A, 1=switch option B // LNB option position // 1 A A // 2 A B // 3 B A // 4 B B bool isHorizontal = ((channel.Polarisation == Polarisation.LinearH) || (channel.Polarisation == Polarisation.CircularL)); byte cmd = 0xf0; cmd |= (byte)(hiBand ? 1 : 0); cmd |= (byte)((isHorizontal) ? 2 : 0); cmd |= (byte)((antennaNr - 1) << 2); const int len = 188; //hauppauge diseqc message length ulong diseqc = 0xE0103800; //currently committed switches only. i.e. ports 1-4 diseqc += cmd; Marshal.WriteByte(_ptrDiseqc, 0, (byte)((diseqc >> 24) & 0xff)); //framing byte Marshal.WriteByte(_ptrDiseqc, 1, (byte)((diseqc >> 16) & 0xff)); //address byte Marshal.WriteByte(_ptrDiseqc, 2, (byte)((diseqc >> 8) & 0xff)); //command byte Marshal.WriteByte(_ptrDiseqc, 3, (byte)(diseqc & 0xff)); //data byte (port group 0) Marshal.WriteInt32(_ptrDiseqc, 160, 4); //send_message_length Marshal.WriteInt32(_ptrDiseqc, 164, 0); //receive_message_length Marshal.WriteInt32(_ptrDiseqc, 168, 3); //amplitude_attenuation if (antennaNr == 1) //for simple diseqc switches (i.e. 22KHz tone burst) { Marshal.WriteByte(_ptrDiseqc, 172, (int)BurstModulationType.TONE_BURST_UNMODULATED); } else { Marshal.WriteByte(_ptrDiseqc, 172, (int)BurstModulationType.TONE_BURST_MODULATED); //default to tone_burst_modulated } Marshal.WriteByte(_ptrDiseqc, 176, (int)DisEqcVersion.DISEQC_VER_1X); //default Marshal.WriteByte(_ptrDiseqc, 180, (int)RxMode.RXMODE_NOREPLY); //default Marshal.WriteByte(_ptrDiseqc, 184, 1); //last_message TRUE */ string txt = ""; for (int i = 0; i < 4; ++i) { txt += String.Format("0x{0:X} ", Marshal.ReadByte(_ptrDiseqc, i)); } for (int i = 160; i < 188; i = (i + 4)) { txt += String.Format("0x{0:X} ", Marshal.ReadInt32(_ptrDiseqc, i)); } Log.Log.Debug("Hauppauge: SendDiseq: {0}", txt); int hr = _propertySet.Set(BdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, _ptrDiseqc, len, _ptrDiseqc, len); if (hr != 0) { succeeded = false; Log.Log.Info("Hauppauge: SendDiseq returned: 0x{0:X} - {1}", hr, DsError.GetErrorText(hr)); } return(succeeded); }
/// <summary> /// Sends the diseq command. /// </summary> /// <param name="channel">The channel.</param> /// <param name="parameters">The channels scanning parameters.</param> public void SendDiseqCommand(ScanParameters parameters, DVBSChannel channel) { if (_isProfRed == false) { return; } if (_previousChannel != null) { if (_previousChannel.Frequency == channel.Frequency && _previousChannel.DisEqc == channel.DisEqc && _previousChannel.Polarisation == channel.Polarisation && _previousChannel.Pilot == channel.Pilot && _previousChannel.Rolloff == channel.Rolloff && _previousChannel.InnerFecRate == channel.InnerFecRate) { _previousChannel = channel; Log.Log.WriteFile("ProfRed: already tuned to diseqc:{0}, frequency:{1}, polarisation:{2}", channel.DisEqc, channel.Frequency, channel.Polarisation); return; } if (_previousChannel.DisEqc == DisEqcType.None && channel.DisEqc == DisEqcType.None) { _previousChannel = channel; Log.Log.WriteFile("ProfRed: already no diseqc used", channel.DisEqc, channel.Frequency, channel.Polarisation); return; } } if (_previousChannel == null && channel.DisEqc == DisEqcType.None) { _previousChannel = channel; Log.Log.WriteFile("ProfRed: diseqc isn't used - skip it", channel.DisEqc, channel.Frequency, channel.Polarisation); return; } _previousChannel = channel; int antennaNr = BandTypeConverter.GetAntennaNr(channel); //hack - bypass diseqc settings for single LNB implementations if (antennaNr == 0) { return; } //end of hack //clear the message params before writing in order to avoid corruption of the diseqc message. for (int i = 0; i < 188; ++i) { Marshal.WriteByte(_ptrDiseqc, i, 0x00); } bool hiBand = BandTypeConverter.IsHiBand(channel, parameters); //bit 0 (1) : 0=low band, 1 = hi band //bit 1 (2) : 0=vertical, 1 = horizontal //bit 3 (4) : 0=satellite position A, 1=satellite position B //bit 4 (8) : 0=switch option A, 1=switch option B // LNB option position // 1 A A // 2 A B // 3 B A // 4 B B bool isHorizontal = ((channel.Polarisation == Polarisation.LinearH) || (channel.Polarisation == Polarisation.CircularL)); byte cmd = 0xf0; cmd |= (byte)(hiBand ? 1 : 0); cmd |= (byte)((isHorizontal) ? 2 : 0); cmd |= (byte)((antennaNr - 1) << 2); const int len = 188; ulong diseqc = 0xE0103800; //currently committed switches only. i.e. ports 1-4 diseqc += cmd; Marshal.WriteByte(_ptrDiseqc, 0, (byte)((diseqc >> 24) & 0xff)); //framing byte Marshal.WriteByte(_ptrDiseqc, 1, (byte)((diseqc >> 16) & 0xff)); //address byte Marshal.WriteByte(_ptrDiseqc, 2, (byte)((diseqc >> 8) & 0xff)); //command byte Marshal.WriteByte(_ptrDiseqc, 3, (byte)(diseqc & 0xff)); //data byte (port group 0) Marshal.WriteByte(_ptrDiseqc, 151, 4); //send_message_length Marshal.WriteByte(_ptrDiseqc, 161, 0); //receive_message_length if (antennaNr == 1) //for simple diseqc switches (i.e. 22KHz tone burst) { Marshal.WriteByte(_ptrDiseqc, 164, 2); // TONE_BURST_UNMODULATED } else { Marshal.WriteByte(_ptrDiseqc, 164, 1); // TONE_BURST_MODULATED } Marshal.WriteByte(_ptrDiseqc, 172, 3); //default for Diseqc Marshal.WriteByte(_ptrDiseqc, 168, 2); //RxMode.RXMODE_NOREPLY);//default Marshal.WriteByte(_ptrDiseqc, 180, 1); //last_message TRUE */ string txt = ""; for (int i = 0; i < 4; ++i) { txt += String.Format("0x{0:X} ", Marshal.ReadByte(_ptrDiseqc, i)); } txt += String.Format("0x{0:X} ", Marshal.ReadByte(_ptrDiseqc, 151)); //send_message_length for (int i = 164; i < 188; i += 4) { txt += String.Format("0x{0:X} ", Marshal.ReadInt32(_ptrDiseqc, i)); } Log.Log.WriteFile("ProfRed: SendDiseq: {0}", txt); int retval; //out value int hr = _propertySet.Get(_bdaTunerExtentionProperties, (int)BdaTunerExtension.KSPROPERTY_BDA_DISEQC, _ptrDiseqc, len, _ptrDiseqc, len, out retval); Log.Log.Info("ProfRed: setdiseqc returned:{0:X}", hr); }