Published v09.3.0.
authorStephane Lenclud
Tue, 19 Jul 2016 17:01:21 +0200
changeset 207ca469451f8e6
parent 206 33be8cb90c57
child 208 6cd9ffdd6386
Published v09.3.0.
Fixing CEC log level control.
Server/CecClient.cs
Server/MainForm.cs
Server/SharpDisplayManager.csproj
     1.1 --- a/Server/CecClient.cs	Tue Jul 19 15:43:04 2016 +0200
     1.2 +++ b/Server/CecClient.cs	Tue Jul 19 17:01:21 2016 +0200
     1.3 @@ -142,7 +142,7 @@
     1.4  
     1.5          public override int ReceiveCommand(CecCommand command)
     1.6          {
     1.7 -            Console.WriteLine(string.Format("CEC command Src:{0} Dst:{1} Ack: {2} Eom: {3} OpcodeSet: {4} Opcode: {5} Timeout: {6}",
     1.8 +            Console.WriteLine(string.Format("CEC command '{5}' from {0} to {1} - Ack: {2} Eom: {3} OpcodeSet: {4} Timeout: {6}",
     1.9                  iLib.ToString(command.Initiator),
    1.10                  iLib.ToString(command.Destination),
    1.11                  command.Ack.ToString(),
    1.12 @@ -302,8 +302,9 @@
    1.13          /// </summary>
    1.14          public void Scan()
    1.15          {
    1.16 -            Console.WriteLine("CEC bus information");
    1.17 -            Console.WriteLine("===================");
    1.18 +            string scanRes = "";
    1.19 +            scanRes += "CEC bus information\n";
    1.20 +            scanRes += "===================\n";
    1.21              CecLogicalAddresses addresses = Lib.GetActiveDevices();
    1.22              for (int iPtr = 0; iPtr < addresses.Addresses.Length; iPtr++)
    1.23              {
    1.24 @@ -320,17 +321,19 @@
    1.25                  string osdName = Lib.GetDeviceOSDName(address);
    1.26                  string lang = Lib.GetDeviceMenuLanguage(address);
    1.27  
    1.28 -                Console.WriteLine("device #" + iPtr + ": " + Lib.ToString(address));
    1.29 -                Console.WriteLine("address:       " + strAddr);
    1.30 -                Console.WriteLine("active source: " + (bActive ? "yes" : "no"));
    1.31 -                Console.WriteLine("vendor:        " + Lib.ToString(iVendorId));
    1.32 -                Console.WriteLine("osd string:    " + osdName);
    1.33 -                Console.WriteLine("CEC version:   " + Lib.ToString(iCecVersion));
    1.34 -                Console.WriteLine("power status:  " + Lib.ToString(power));
    1.35 +                scanRes += "device #" + iPtr + ": " + Lib.ToString(address) + "\n";
    1.36 +                scanRes += "address:       " + strAddr + "\n";
    1.37 +                scanRes += "active source: " + (bActive ? "yes" : "no") + "\n";
    1.38 +                scanRes += "vendor:        " + Lib.ToString(iVendorId) + "\n";
    1.39 +                scanRes += "osd string:    " + osdName + "\n";
    1.40 +                scanRes += "CEC version:   " + Lib.ToString(iCecVersion) + "\n";
    1.41 +                scanRes += "power status:  " + Lib.ToString(power) + "\n";
    1.42                  if (!string.IsNullOrEmpty(lang))
    1.43 -                    Console.WriteLine("language:      " + lang);
    1.44 -                Console.WriteLine("");
    1.45 +                    scanRes += "language:      " + lang + "\n";
    1.46 +                scanRes += "===================" + "\n";
    1.47              }
    1.48 +
    1.49 +            Console.Write(scanRes);
    1.50          }
    1.51  
    1.52          public void ListAdapters()
     2.1 --- a/Server/MainForm.cs	Tue Jul 19 15:43:04 2016 +0200
     2.2 +++ b/Server/MainForm.cs	Tue Jul 19 17:01:21 2016 +0200
     2.3 @@ -2577,27 +2577,35 @@
     2.4                  Properties.Settings.Default.CecMonitorOff,
     2.5                  Properties.Settings.Default.CecReconnectToPowerTv);
     2.6  
     2.7 -                //Setup log level
     2.8 -                iCecManager.Client.LogLevel = 0;
     2.9 +                SetupCecLogLevel();
    2.10 +            }
    2.11 +        }
    2.12  
    2.13 -                if (checkBoxCecLogError.Checked)
    2.14 -                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Error;
    2.15 +        /// <summary>
    2.16 +        /// 
    2.17 +        /// </summary>
    2.18 +        private void SetupCecLogLevel()
    2.19 +        {
    2.20 +            //Setup log level
    2.21 +            iCecManager.Client.LogLevel = 0;
    2.22  
    2.23 -                if (checkBoxCecLogWarning.Checked)
    2.24 -                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Warning;
    2.25 +            if (checkBoxCecLogError.Checked)
    2.26 +                iCecManager.Client.LogLevel |= (int)CecLogLevel.Error;
    2.27  
    2.28 -                if (checkBoxCecLogNotice.Checked)
    2.29 -                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Notice;
    2.30 +            if (checkBoxCecLogWarning.Checked)
    2.31 +                iCecManager.Client.LogLevel |= (int)CecLogLevel.Warning;
    2.32  
    2.33 -                if (checkBoxCecLogTraffic.Checked)
    2.34 -                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Traffic;
    2.35 +            if (checkBoxCecLogNotice.Checked)
    2.36 +                iCecManager.Client.LogLevel |= (int)CecLogLevel.Notice;
    2.37  
    2.38 -                if (checkBoxCecLogDebug.Checked)
    2.39 -                    iCecManager.Client.LogLevel &= (int)CecLogLevel.Debug;
    2.40 +            if (checkBoxCecLogTraffic.Checked)
    2.41 +                iCecManager.Client.LogLevel |= (int)CecLogLevel.Traffic;
    2.42  
    2.43 -                iCecManager.Client.FilterOutPollLogs = checkBoxCecLogNoPoll.Checked;
    2.44 +            if (checkBoxCecLogDebug.Checked)
    2.45 +                iCecManager.Client.LogLevel |= (int)CecLogLevel.Debug;
    2.46  
    2.47 -            }
    2.48 +            iCecManager.Client.FilterOutPollLogs = checkBoxCecLogNoPoll.Checked;
    2.49 +
    2.50          }
    2.51  
    2.52          private void ButtonStartIdleClient_Click(object sender, EventArgs e)
    2.53 @@ -2612,7 +2620,7 @@
    2.54  
    2.55          private void checkBoxCecLogs_CheckedChanged(object sender, EventArgs e)
    2.56          {
    2.57 -            ResetCec();
    2.58 +            SetupCecLogLevel();
    2.59          }
    2.60      }
    2.61  }
     3.1 --- a/Server/SharpDisplayManager.csproj	Tue Jul 19 15:43:04 2016 +0200
     3.2 +++ b/Server/SharpDisplayManager.csproj	Tue Jul 19 17:01:21 2016 +0200
     3.3 @@ -34,7 +34,7 @@
     3.4      <WebPage>index.htm</WebPage>
     3.5      <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
     3.6      <ApplicationRevision>0</ApplicationRevision>
     3.7 -    <ApplicationVersion>0.9.2.0</ApplicationVersion>
     3.8 +    <ApplicationVersion>0.9.3.0</ApplicationVersion>
     3.9      <UseApplicationTrust>false</UseApplicationTrust>
    3.10      <CreateDesktopShortcut>true</CreateDesktopShortcut>
    3.11      <PublishWizardCompleted>true</PublishWizardCompleted>