Пример #1
0
        /// <summary>
        /// Start the IR Server plugin.
        /// </summary>
        public override void Start()
        {
            if (!_running)
            {
                LoadSettings();

                _receiverWindow          = new ReceiverWindow("FireDTV Receiver");
                _receiverWindow.ProcMsg += WndProc;

                _fireDTV = new FireDTVControl(_receiverWindow.Handle);
                if (!_fireDTV.OpenDrivers())
                {
                    throw new InvalidOperationException("Failed to start FireDTV interface");
                }

                // Search for the named sourcefilter
                FireDTVSourceFilterInfo sourceFilter = string.IsNullOrEmpty(_deviceName) ? _fireDTV.SourceFilters.Item(0) : _fireDTV.SourceFilters.ItemByName(_deviceName);

                if (sourceFilter != null)
                {
                    sourceFilter.StartFireDTVRemoteControlSupport();
                    _running = true;
                }
                else
                {
                    throw new InvalidOperationException("Failed to start FireDTV interface");
                }
            }
        }
Пример #2
0
 internal void CloseDrivers()
 {
     for (int DeviceCount = 0; DeviceCount < SourceFilters.Count; DeviceCount++)
     {
         FireDTVSourceFilterInfo SourceFilter = SourceFilters.Item(DeviceCount);
         _sourceFilterCollection.RemoveAt(DeviceCount);
     }
 }
 internal int IndexByHandle(uint deviceHandle)
 {
     for (int iIndex = 0; iIndex < List.Count; iIndex++)
     {
         FireDTVSourceFilterInfo SourceFilter = Item(iIndex);
         if (SourceFilter.Handle == deviceHandle)
         {
             return(iIndex);
         }
     }
     return(-1);
 }
 internal void Add(FireDTVSourceFilterInfo sourceFilter)
 {
     foreach (FireDTVSourceFilterInfo srcFilter in List)
     {
         if (srcFilter.Name == sourceFilter.Name)
         {
             sourceFilter.Close();
             return;
         }
     }
     List.Add(sourceFilter);
 }
Пример #5
0
 internal void CloseFireDTVHandle(FireDTVSourceFilterInfo currentSourceFilter)
 {
     try
     {
         uint returnCode = FireDTVAPI.FS_CloseDeviceHandle(currentSourceFilter.Handle);
         if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
         {
             throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Device Close Failure");
         }
     }
     catch (Exception)
     {
     }
 }
Пример #6
0
        /// <summary>
        /// Open the communication channels with the FireDTV's.
        /// </summary>
        /// <returns>true if success</returns>
        internal bool OpenDrivers()
        {
            if (!LibrayInitialized)
            {
                return(false);
            }

            int BDADriverCount = getBDACount();
            int WDMDriverCount = getWDMCount();

            for (int BDACount = 0; BDACount < BDADriverCount; BDACount++)
            {
                FireDTVSourceFilterInfo bdaSourceFilter = new FireDTVSourceFilterInfo(OpenBDADevice(BDACount), _windowHandle);
                _sourceFilterCollection.Add(bdaSourceFilter);
            }

            for (int WDMCount = 0; WDMCount < WDMDriverCount; WDMCount++)
            {
                FireDTVSourceFilterInfo wdmSourceFilter = new FireDTVSourceFilterInfo(OpenWDMDevice(WDMCount), _windowHandle);
                _sourceFilterCollection.Add(wdmSourceFilter);
            }
            return(true);
        }