Server/CecClient.cs
changeset 206 33be8cb90c57
parent 203 ce63ebb51da4
child 207 ca469451f8e6
     1.1 --- a/Server/CecClient.cs	Mon Jul 18 15:56:25 2016 +0200
     1.2 +++ b/Server/CecClient.cs	Tue Jul 19 15:43:04 2016 +0200
     1.3 @@ -40,11 +40,46 @@
     1.4      class Client : CecCallbackMethods
     1.5      {
     1.6          /// <summary>
     1.7 +        /// Provide direct access to CEC library
     1.8 +        /// </summary>
     1.9 +        public LibCecSharp Lib
    1.10 +        {
    1.11 +            get
    1.12 +            {
    1.13 +                return iLib;
    1.14 +            }
    1.15 +        }
    1.16 +
    1.17 +        /// <summary>
    1.18 +        /// 
    1.19 +        /// </summary>
    1.20 +        public int LogLevel = (int)CecLogLevel.Notice;
    1.21 +
    1.22 +        /// <summary>
    1.23 +        /// 
    1.24 +        /// </summary>
    1.25 +        public bool FilterOutPollLogs = true;
    1.26 +
    1.27 +        /// <summary>
    1.28 +        /// 
    1.29 +        /// </summary>
    1.30 +        private LibCecSharp iLib;
    1.31 +        /// <summary>
    1.32 +        /// 
    1.33 +        /// </summary>
    1.34 +        private LibCECConfiguration Config;
    1.35 +
    1.36 +        /// <summary>
    1.37 +        /// 
    1.38 +        /// </summary>
    1.39 +        private bool iConnected;
    1.40 +
    1.41 +        /// <summary>
    1.42          /// 
    1.43          /// </summary>
    1.44          /// <param name="aDeviceName"></param>
    1.45          /// <param name="aHdmiPort"></param>
    1.46 -        public Client(string aDeviceName, byte aHdmiPort, CecDeviceType aDeviceType = CecDeviceType.PlaybackDevice, CecLogLevel aLogLevel = CecLogLevel.Warning)
    1.47 +        public Client(string aDeviceName, byte aHdmiPort, CecDeviceType aDeviceType = CecDeviceType.PlaybackDevice)
    1.48          {
    1.49              Config = new LibCECConfiguration();
    1.50              Config.DeviceTypes.Types[0] = aDeviceType;
    1.51 @@ -52,7 +87,6 @@
    1.52              Config.HDMIPort = aHdmiPort;
    1.53              //Config.ClientVersion = LibCECConfiguration.CurrentVersion;
    1.54              Config.SetCallbacks(this);
    1.55 -            LogLevel = (int)aLogLevel;
    1.56  
    1.57              iLib = new LibCecSharp(Config);
    1.58              iLib.InitVideoStandalone();
    1.59 @@ -148,6 +182,11 @@
    1.60                          break;
    1.61                      case CecLogLevel.Debug:
    1.62                          strLevel = "DEBUG: ";
    1.63 +                        if (message.Message.IndexOf("POLL") != -1 && FilterOutPollLogs)
    1.64 +                        {
    1.65 +                            //We have an option to prevent spamming with poll debug logs
    1.66 +                            return 1;
    1.67 +                        }
    1.68                          break;
    1.69                      default:
    1.70                          break;
    1.71 @@ -510,33 +549,6 @@
    1.72              }
    1.73          }
    1.74         
    1.75 -        /// <summary>
    1.76 -        /// Provide direct access to CEC library
    1.77 -        /// </summary>
    1.78 -        public LibCecSharp Lib
    1.79 -        {
    1.80 -            get
    1.81 -            {
    1.82 -                return iLib;
    1.83 -            }
    1.84 -        }
    1.85  
    1.86 -        /// <summary>
    1.87 -        /// 
    1.88 -        /// </summary>
    1.89 -        private int LogLevel;
    1.90 -        /// <summary>
    1.91 -        /// 
    1.92 -        /// </summary>
    1.93 -        private LibCecSharp iLib;
    1.94 -        /// <summary>
    1.95 -        /// 
    1.96 -        /// </summary>
    1.97 -        private LibCECConfiguration Config;
    1.98 -
    1.99 -        /// <summary>
   1.100 -        /// 
   1.101 -        /// </summary>
   1.102 -        private bool iConnected;
   1.103      }
   1.104  }