/// <summary>
        /// sets the QAM modulation for ATSC cards under XP
        /// </summary>
        public void SetXPATSCQam(ATSCChannel channel)
        {
            if (_isGenericATSC == false)
            {
                return;
            }
            KSPropertySupport supported;

            _propertySet.QuerySupported(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, out supported);
            if ((supported & KSPropertySupport.Set) == KSPropertySupport.Set)
            {
                Log.Log.Info("GenericATSC: Set ModulationType: {0}", channel.ModulationType);
                Marshal.WriteInt32(_tempValue, (Int32)channel.ModulationType);
                int hr = _propertySet.Set(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, _tempInstance, 32,
                                          _tempValue, 4);
                if (hr != 0)
                {
                    Log.Log.Info("GenericATSC: Set returned: 0x{0:X} - {1}", hr, HResult.GetDXErrorString(hr));
                }
            }
            //Below is for debug only...

            /*
             * if ((supported & KSPropertySupport.Get) == KSPropertySupport.Get)
             * {
             * Log.Log.Info("GenericATSC: Get ModulationType");
             * Marshal.WriteInt32(_tempValue, (Int32)0);
             * hr = _propertySet.Get(guidBdaDigitalDemodulator, (int)BdaDigitalModulator.MODULATION_TYPE, _tempInstance, 32, _tempValue, 4, out length);
             * Log.Log.Info("GenericATSC: Get   returned:{0:X} len:{1} value:{2}", hr, length, Marshal.ReadInt32(_tempValue));
             * }
             */
        }
        /// <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));
            }
        }