Example #1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="TvCardDvbB2C2"/> class.
    /// </summary>
    /// <param name="device">The device.</param>
    public TvCardDvbB2C2(DsDevice device, DeviceInfo deviceInfo)
      : base(device)
    {
      _deviceInfo = deviceInfo;
      _devicePath = deviceInfo.DevicePath;
      _name = deviceInfo.Name;
      GetPreloadBitAndCardId();

      _useDISEqCMotor = false;
      TvBusinessLayer layer = new TvBusinessLayer();
      Card card = layer.GetCardByDevicePath(_devicePath);
      if (card != null)
      {
        Setting setting = layer.GetSetting("dvbs" + card.IdCard + "motorEnabled", "no");
        if (setting.Value == "yes")
          _useDISEqCMotor = true;
      }
      _conditionalAccess = new ConditionalAccess(null, null, null, this);
      _ptrDisEqc = Marshal.AllocCoTaskMem(20);
      _disEqcMotor = new DiSEqCMotor(this);
      GetTunerCapabilities();
    }
Example #2
0
        public static void GetTunerInformation(out uint numberOfTuners, out List <DeviceInfo> deviceList)
        {
            numberOfTuners = 0;
            deviceList     = new List <DeviceInfo>();
            //=========================================================================================================
            // add the B2C2 specific filters
            //=========================================================================================================
            IBaseFilter filterB2C2Adapter =
                Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_B2C2Adapter, false)) as IBaseFilter;

            if (filterB2C2Adapter == null)
            {
                Log.Log.Error("b2c2:GetTunerCapabilities() _filterB2C2Adapter not found");
                return;
            }
            IB2C2MPEG2DataCtrl6 interfaceB2C2DataCtrl = filterB2C2Adapter as IB2C2MPEG2DataCtrl6;

            if (interfaceB2C2DataCtrl == null)
            {
                Log.Log.Error("b2c2: cannot get IB2C2MPEG2DataCtrl6");
                return;
            }
            int    deviceInfoSize = Marshal.SizeOf(typeof(tagDEVICE_INFORMATION)) * 16;
            IntPtr ptDeviceInfo   = Marshal.AllocHGlobal(deviceInfoSize);

            numberOfTuners = 16;
            int hr = interfaceB2C2DataCtrl.GetDeviceList(ptDeviceInfo, ref deviceInfoSize, ref numberOfTuners);

            if (hr != 0)
            {
                Log.Log.Error("b2c2: GetDeviceList failed:0x{0:X}", hr);
            }
            Log.Log.WriteFile("Result: " + numberOfTuners);
            long currentPtr = ptDeviceInfo.ToInt64(); // Must work both on x86 and x64

            for (int i = 0; i < numberOfTuners; i++)
            {
                IntPtr RectPtr           = new IntPtr(currentPtr);
                tagDEVICE_INFORMATION tc = (tagDEVICE_INFORMATION)Marshal.PtrToStructure(RectPtr, typeof(tagDEVICE_INFORMATION));
                CardType cardType        = CardType.Unknown;
                switch (tc.eTunerModulation)
                {
                case TunerType.ttSat:
                    cardType = CardType.DvbS;
                    break;

                case TunerType.ttCable:
                    cardType = CardType.DvbC;
                    break;

                case TunerType.ttTerrestrial:
                    cardType = CardType.DvbT;
                    break;

                case TunerType.ttATSC:
                    cardType = CardType.Atsc;
                    break;

                case TunerType.ttUnknown:
                    cardType = CardType.Unknown;
                    break;
                }

                DeviceInfo device = new DeviceInfo
                {
                    DeviceId   = tc.dwDeviceID,
                    Name       = tc.wsProductName + " (" + tc.wsProductRevision + ")",
                    CardType   = cardType,
                    DevicePath =
                        String.Format("device:{0}_{1}_{2}_[{3:X02}:{4:X02}:{5:X02}:{6:X02}:{7:X02}:{8:X02}]",
                                      tc.eBusInterface,
                                      tc.dwDeviceID, tc.dwProductID, tc.ucMACAddress[0], tc.ucMACAddress[1],
                                      tc.ucMACAddress[2],
                                      tc.ucMACAddress[3], tc.ucMACAddress[4], tc.ucMACAddress[5])
                };
                deviceList.Add(device);
                currentPtr += Marshal.SizeOf(typeof(tagDEVICE_INFORMATION));
            }
            Marshal.FreeHGlobal(ptDeviceInfo);
            // Release all used object
            Release.ComObject("tuner filter", filterB2C2Adapter);
        }
Example #3
0
    public static void GetTunerInformation(out uint numberOfTuners, out List<DeviceInfo> deviceList)
    {
      numberOfTuners = 0;
      deviceList = new List<DeviceInfo>();
      //=========================================================================================================
      // add the B2C2 specific filters
      //=========================================================================================================
      IBaseFilter filterB2C2Adapter =
        Activator.CreateInstance(Type.GetTypeFromCLSID(CLSID_B2C2Adapter, false)) as IBaseFilter;
      if (filterB2C2Adapter == null)
      {
        Log.Log.Error("b2c2:GetTunerCapabilities() _filterB2C2Adapter not found");
        return;
      }
      IB2C2MPEG2DataCtrl6 interfaceB2C2DataCtrl = filterB2C2Adapter as IB2C2MPEG2DataCtrl6;
      if (interfaceB2C2DataCtrl == null)
      {
        Log.Log.Error("b2c2: cannot get IB2C2MPEG2DataCtrl6");
        return;
      }
      int deviceInfoSize = Marshal.SizeOf(typeof(tagDEVICE_INFORMATION)) * 16;
      IntPtr ptDeviceInfo = Marshal.AllocHGlobal(deviceInfoSize);
      numberOfTuners = 16;
      int hr = interfaceB2C2DataCtrl.GetDeviceList(ptDeviceInfo, ref deviceInfoSize, ref numberOfTuners);
      if (hr != 0)
      {
        Log.Log.Error("b2c2: GetDeviceList failed:0x{0:X}", hr);
      }
      Log.Log.WriteFile("Result: " + numberOfTuners);
      long currentPtr = ptDeviceInfo.ToInt64(); // Must work both on x86 and x64
      for (int i = 0; i < numberOfTuners; i++)
      {
        IntPtr RectPtr = new IntPtr(currentPtr);
        tagDEVICE_INFORMATION tc = (tagDEVICE_INFORMATION)Marshal.PtrToStructure(RectPtr, typeof(tagDEVICE_INFORMATION));
        CardType cardType = CardType.Unknown;
        switch (tc.eTunerModulation)
        {
          case TunerType.ttSat:
            cardType = CardType.DvbS;
            break;
          case TunerType.ttCable:
            cardType = CardType.DvbC;
            break;
          case TunerType.ttTerrestrial:
            cardType = CardType.DvbT;
            break;
          case TunerType.ttATSC:
            cardType = CardType.Atsc;
            break;
          case TunerType.ttUnknown:
            cardType = CardType.Unknown;
            break;
        }

        DeviceInfo device = new DeviceInfo
                              {
                                DeviceId = tc.dwDeviceID,
                                Name = tc.wsProductName + " (" + tc.wsProductRevision + ")",
                                CardType = cardType,
                                DevicePath =
                                  String.Format("device:{0}_{1}_{2}_[{3:X02}:{4:X02}:{5:X02}:{6:X02}:{7:X02}:{8:X02}]",
                                                tc.eBusInterface,
                                                tc.dwDeviceID, tc.dwProductID, tc.ucMACAddress[0], tc.ucMACAddress[1],
                                                tc.ucMACAddress[2],
                                                tc.ucMACAddress[3], tc.ucMACAddress[4], tc.ucMACAddress[5])
                              };
        deviceList.Add(device);
        currentPtr += Marshal.SizeOf(typeof(tagDEVICE_INFORMATION));
      }
      Marshal.FreeHGlobal(ptDeviceInfo);
      // Release all used object
      Release.ComObject("tuner filter", filterB2C2Adapter);
    }