Ejemplo n.º 1
0
        /// <summary>
        /// Create a copy of this instance.
        /// </summary>
        /// <returns>A new instance with the same properties.</returns>
        public SatelliteDish Clone()
        {
            SatelliteDish dish = new SatelliteDish();

            dish.LNBLowBandFrequency  = lnbLowBandFrequency;
            dish.LNBHighBandFrequency = lnbHighBandFrequency;
            dish.LNBSwitchFrequency   = lnbSwitchFrequency;
            dish.DiseqcSwitch         = diseqcSwitch;

            return(dish);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check if this instance is equal to another.
        /// </summary>
        /// <param name="dish">The other instance.</param>
        /// <returns>True if the instances are equal; false otherwise.</returns>
        public bool EqualTo(SatelliteDish dish)
        {
            if (lnbLowBandFrequency != dish.LNBLowBandFrequency)
            {
                return(false);
            }

            if (lnbHighBandFrequency != dish.LNBHighBandFrequency)
            {
                return(false);
            }

            if (lnbSwitchFrequency != dish.LNBSwitchFrequency)
            {
                return(false);
            }

            if (diseqcSwitch != dish.DiseqcSwitch)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private int processDish(string parts)
        {
            string[] parameters = parts.Split(new char[] { ',' });
            if (parameters.Length < 3 || parameters.Length > 4)
            {
                Logger.Instance.Write("INI file format error: The Dish line is wrong.");
                return (errorCodeFormatError);
            }

            SatelliteDish satelliteDish = new SatelliteDish();

            try
            {
                satelliteDish.LNBLowBandFrequency = Int32.Parse(parameters[0].Trim());
                satelliteDish.LNBHighBandFrequency = Int32.Parse(parameters[1].Trim());
                satelliteDish.LNBSwitchFrequency = Int32.Parse(parameters[2].Trim());
                if (parameters.Length == 4)
                    satelliteDish.DiseqcSwitch = parameters[3].ToUpperInvariant().Trim();

                currentDish = satelliteDish;

                if (currentFrequency as SatelliteFrequency != null)
                    (currentFrequency as SatelliteFrequency).SatelliteDish = currentDish;
            }
            catch (FormatException)
            {
                Logger.Instance.Write("INI file format error: The Dish line is wrong.");
                return (errorCodeFormatError);
            }
            catch (ArithmeticException)
            {
                Logger.Instance.Write("INI file format error: The Dish line is wrong.");
                return (errorCodeFormatError);
            }

            return (errorCodeNoError);
        }
Ejemplo n.º 4
0
        private void setLnbData(bool lnbPower, int turnon22Khz, int disEqcPort, SatelliteDish satelliteDish)
        {
            int thbdaLen = 0x28;
            int disEqcLen = 20;

            Marshal.WriteByte(ptrDiseqc, 0, (byte)(lnbPower ? 1 : 0));                                  // 0: LNB_POWER
            Marshal.WriteByte(ptrDiseqc, 1, 0);                                                         // 1: Tone_Data_Burst (Tone_Data_OFF:0 | Tone_Burst_ON:1 | Data_Burst_ON:2)
            Marshal.WriteByte(ptrDiseqc, 2, 0);
            Marshal.WriteByte(ptrDiseqc, 3, 0);
            Marshal.WriteInt32(ptrDiseqc, 4, satelliteDish.LNBLowBandFrequency / 1000);     // 4: LNBLOF LowBand MHz
            Marshal.WriteInt32(ptrDiseqc, 8, satelliteDish.LNBHighBandFrequency / 1000);    // 8: LNBLOF HighBand MHz
            Marshal.WriteInt32(ptrDiseqc, 12, satelliteDish.LNBSwitchFrequency / 1000);     //12: LNBLOF HiLoSW MHz
            Marshal.WriteByte(ptrDiseqc, 16, (byte)turnon22Khz);                                        //16: f22K_Output (F22K_Output_HiLo:0 | F22K_Output_Off:1 | F22K_Output_On:2
            Marshal.WriteByte(ptrDiseqc, 17, (byte)disEqcPort);                                         //17: DiSEqC_Port
            Marshal.WriteByte(ptrDiseqc, 18, 0);
            Marshal.WriteByte(ptrDiseqc, 19, 0);
            Marshal.WriteInt32(thbdaBuf, 0, 0x255e0082);                                    //GUID_THBDA_CMD
            Marshal.WriteInt16(thbdaBuf, 4, 0x2017);
            Marshal.WriteInt16(thbdaBuf, 6, 0x4b03);
            Marshal.WriteByte(thbdaBuf, 8, 0x90);
            Marshal.WriteByte(thbdaBuf, 9, 0xf8);
            Marshal.WriteByte(thbdaBuf, 10, 0x85);
            Marshal.WriteByte(thbdaBuf, 11, 0x6a);
            Marshal.WriteByte(thbdaBuf, 12, 0x62);
            Marshal.WriteByte(thbdaBuf, 13, 0xcb);
            Marshal.WriteByte(thbdaBuf, 14, 0x3d);
            Marshal.WriteByte(thbdaBuf, 15, 0x67);
            Marshal.WriteInt32(thbdaBuf, 16, (int)THBDA_IOCTL_SET_LNB_DATA);                    //dwIoControlCode
            Marshal.WriteInt32(thbdaBuf, 20, (int)ptrDiseqc.ToInt32());                         //lpInBuffer
            Marshal.WriteInt32(thbdaBuf, 24, disEqcLen);                                        //nInBufferSize
            Marshal.WriteInt32(thbdaBuf, 28, (int)IntPtr.Zero);                                 //lpOutBuffer
            Marshal.WriteInt32(thbdaBuf, 32, 0);                                                //nOutBufferSize
            Marshal.WriteInt32(thbdaBuf, 36, (int)ptrDwBytesReturned);                          //lpBytesReturned

            IPin pin = DsFindPin.ByDirection(captureFilter, PinDirection.Input, 0);
            if (pin != null)
            {
                IKsPropertySet propertySet = pin as IKsPropertySet;
                if (propertySet != null)
                {
                    reply = propertySet.Set(THBDA_TUNER, 0, ptrOutBuffer2, 0x18, thbdaBuf, thbdaLen);
                    if (reply != 0)
                        Logger.Instance.Write("TwinHan/TechniSat SetLNB failed 0x" + reply.ToString("X"));
                    else
                        Logger.Instance.Write("TwinHan/TechniSat SetLNB OK 0x" + reply.ToString("X"));

                    Marshal.ReleaseComObject(propertySet);
                }

                Marshal.ReleaseComObject(pin);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Check if this instance is equal to another.
        /// </summary>
        /// <param name="dish">The other instance.</param>
        /// <returns>True if the instances are equal; false otherwise.</returns>
        public bool EqualTo(SatelliteDish dish)
        {
            if (lnbLowBandFrequency != dish.LNBLowBandFrequency)
                return (false);

            if (lnbHighBandFrequency != dish.LNBHighBandFrequency)
                return (false);

            if (lnbSwitchFrequency != dish.LNBSwitchFrequency)
                return (false);

            if (diseqcSwitch != dish.DiseqcSwitch)
                return (false);

            return (true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a copy of this instance.
        /// </summary>
        /// <returns>A new instance with the same properties.</returns>
        public SatelliteDish Clone()
        {
            SatelliteDish dish = new SatelliteDish();

            dish.LNBLowBandFrequency = lnbLowBandFrequency;
            dish.LNBHighBandFrequency = lnbHighBandFrequency;
            dish.LNBSwitchFrequency = lnbSwitchFrequency;
            dish.DiseqcSwitch = diseqcSwitch;

            return (dish);
        }