Пример #1
0
        public FireDTVSourceFilterInfo(uint deviceHandle, IntPtr activeWindow)
            : base()
        {
            _windowHandle = activeWindow;
            _handle       = deviceHandle;

            StringBuilder displayName = new StringBuilder(256);
            uint          returnCode  = FireDTVAPI.FS_GetDisplayString(Handle, displayName);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode,
                                           "Unable to get Device Display Name!");
            }
            _name = displayName.ToString();

            StringBuilder GuidString = new StringBuilder(256);

            returnCode = FireDTVAPI.FS_GetGUIDString(Handle, GuidString);
            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to get GUID String!");
            }
            _GUID = GuidString.ToString();

            string DriverFriend;

            returnCode = FireDTVAPI.FS_GetFriendlyString(Handle, out DriverFriend);
            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode,
                                           "Unable to get Device Friendly Name!");
            }
            _friendlyName = DriverFriend;

            FireDTVConstants.FireDTV_DRIVER_VERSION version = new FireDTVConstants.FireDTV_DRIVER_VERSION();
            returnCode = FireDTVAPI.FS_GetDriverVersion(Handle, ref version);
            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to get Driver Version!");
            }
            _driverVersion = Encoding.ASCII.GetString(version.DriverVersion);

            returnCode = FireDTVAPI.FS_GetFirmwareVersion(Handle, ref _firmwareVersion);
            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode,
                                           "Unable to get Firmware Hardware Version!");
            }

            returnCode = FireDTVAPI.FS_GetSystemInfo(Handle, ref _systemInfo);
            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to get System Information!");
            }


            RegisterNotifications();
        }
Пример #2
0
        public void StopFireDTVRemoteControlSupport()
        {
            uint returnCode = FireDTVAPI.FS_RemoteControl_Stop(Handle);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to Stop RC Support");
            }
            _remoteRunning = true;
        }
Пример #3
0
        public void UnRegisterNotifications()
        {
            uint returnCode = FireDTVAPI.FS_UnregisterNotifications(Handle);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to unRegister Notifiations");
            }
            _notificationRegistered = false;
        }
Пример #4
0
        public void RegisterNotifications()
        {
            uint returnCode = FireDTVAPI.FS_RegisterNotifications(Handle, (int)this.WindowHandle);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to Register Notifiations");
            }
            _notificationRegistered = true;
        }
Пример #5
0
        internal void CloseFireDTVHandle()
        {
            uint returnCode = FireDTVAPI.FS_CloseDeviceHandle(Handle);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Device Close Failure");
            }
            _handle = 0;
        }
Пример #6
0
        internal uint OpenBDADevice(int deviceIndex)
        {
            uint DeviceHandle;
            uint returnCode = FireDTVAPI.FS_OpenBDADeviceHandle((uint)deviceIndex, out DeviceHandle);

            if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
            {
                throw new FireDTVDeviceOpenException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Open BDA Device Error!");
            }
            return(DeviceHandle);
        }
Пример #7
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) {}
 }
Пример #8
0
 internal void UnRegisterNotifications(uint widowHandle)
 {
     if (NotificationsRegistered)
     {
         uint returnCode = FireDTVAPI.FS_UnregisterNotifications(widowHandle);
         if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
         {
             throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode,
                                        "Unable to unRegister Notifiations");
         }
         NotificationsRegistered = false;
     }
 }
Пример #9
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 ex)
     {
         Log.Error("FireSATControl:CloseFireDTVHandle {0}", ex.Message);
     }
 }
Пример #10
0
 internal void RegisterGeneralNotifications()
 {
     if (!NotificationsRegistered)
     {
         try
         {
             uint returnCode = FireDTVAPI.FS_RegisterGeneralNotifications((int)WindowsHandle);
             if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
             {
                 throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode,
                                            "Unable to Register General Notifiations");
             }
             NotificationsRegistered = true;
         }
         catch (Exception) {}
     }
 }
Пример #11
0
 internal int getBDACount()
 {
     try
     {
         uint BDACount;
         uint returnCode = FireDTVAPI.FS_GetNumberOfBDADevices(out BDACount);
         if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
         {
             throw new FireDTVException((FireDTVConstants.FireDTVStatusCodes)returnCode, "Unable to BDA Driver Count");
         }
         return((int)BDACount);
     }
     catch (Exception ex)
     {
         Log.Error("FireSATControl: Error getting BDA Devices {0}", ex.Message);
     }
     return(0);
 }
Пример #12
0
 internal void InitializeLibrary()
 {
     if (!LibrayInitialized)
     {
         try
         {
             uint returnCode = FireDTVAPI.FS_Initialize();
             if ((FireDTVConstants.FireDTVStatusCodes)returnCode != FireDTVConstants.FireDTVStatusCodes.Success)
             {
                 throw new FireDTVInitializationException("Initilization Failure (" + returnCode.ToString() + ")");
             }
             LibrayInitialized = true;
             Log.Info("FireDTV: dll initialized");
         }
         catch (Exception e)
         {
             Log.Error("FireDTV: error initializing {0}", e.Message);
         }
     }
 }