예제 #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);
         }
     }
 }