/// <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)); } }