cec-config-gui: added some basic test commands and device information
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 19:06:04 +0000 (20:06 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 14 Feb 2012 19:06:04 +0000 (20:06 +0100)
src/cec-config-gui/CecConfigGUI.Designer.cs
src/cec-config-gui/CecConfigGUI.cs
src/cec-config-gui/DeviceInformation.Designer.cs [new file with mode: 0644]
src/cec-config-gui/DeviceInformation.cs [new file with mode: 0644]
src/cec-config-gui/DeviceInformation.resx [new file with mode: 0644]
src/cec-config-gui/actions/SendActivateSource.cs [new file with mode: 0644]
src/cec-config-gui/actions/SendImageViewOn.cs [new file with mode: 0644]
src/cec-config-gui/actions/SendStandby.cs [new file with mode: 0644]
src/cec-config-gui/actions/ShowDeviceInfo.cs [new file with mode: 0644]
src/cec-config-gui/cec-config-gui.csproj

index 4b5eabb61fd32e65b571460a3554e4ace1d9b673..d3907535c49f5c0a6f575f8300f4bb079321ce23 100644 (file)
       this.lPortNumber = new System.Windows.Forms.Label();
       this.tbButtons = new System.Windows.Forms.TabPage();
       this.dgButtons = new System.Windows.Forms.DataGridView();
+      this.CecButtonName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+      this.playerButtonDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+      this.cecButtonConfigBindingSource = new System.Windows.Forms.BindingSource(this.components);
+      this.tbTestCommands = new System.Windows.Forms.TabPage();
+      this.bActivateSource = new System.Windows.Forms.Button();
+      this.bScan = new System.Windows.Forms.Button();
+      this.bStandby = new System.Windows.Forms.Button();
+      this.bSendImageViewOn = new System.Windows.Forms.Button();
+      this.lDestination = new System.Windows.Forms.Label();
+      this.cbCommandDestination = new System.Windows.Forms.ComboBox();
       this.LogOutput = new System.Windows.Forms.TabPage();
       this.bSaveLog = new System.Windows.Forms.Button();
       this.bClearLog = new System.Windows.Forms.Button();
       this.helpConnectedHDMIDevice = new System.Windows.Forms.ToolTip(this.components);
       this.helpPhysicalAddress = new System.Windows.Forms.ToolTip(this.components);
       this.helpDeviceType = new System.Windows.Forms.ToolTip(this.components);
-      this.cecButtonConfigBindingSource = new System.Windows.Forms.BindingSource(this.components);
-      this.CecButtonName = new System.Windows.Forms.DataGridViewTextBoxColumn();
-      this.playerButtonDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
       this.tabControl1.SuspendLayout();
       this.Configuration.SuspendLayout();
       this.tbButtons.SuspendLayout();
       ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).BeginInit();
-      this.LogOutput.SuspendLayout();
       ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).BeginInit();
+      this.tbTestCommands.SuspendLayout();
+      this.LogOutput.SuspendLayout();
       this.SuspendLayout();
       // 
       // tabControl1
       // 
       this.tabControl1.Controls.Add(this.Configuration);
       this.tabControl1.Controls.Add(this.tbButtons);
+      this.tabControl1.Controls.Add(this.tbTestCommands);
       this.tabControl1.Controls.Add(this.LogOutput);
       this.tabControl1.Location = new System.Drawing.Point(12, 12);
       this.tabControl1.Name = "tabControl1";
       this.dgButtons.TabIndex = 0;
       this.dgButtons.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridView1_CellFormatting);
       // 
+      // CecButtonName
+      // 
+      this.CecButtonName.DataPropertyName = "CecButtonName";
+      this.CecButtonName.FillWeight = 260F;
+      this.CecButtonName.HeaderText = "Button";
+      this.CecButtonName.Name = "CecButtonName";
+      this.CecButtonName.ReadOnly = true;
+      this.CecButtonName.Width = 260;
+      // 
+      // playerButtonDataGridViewTextBoxColumn
+      // 
+      this.playerButtonDataGridViewTextBoxColumn.DataPropertyName = "PlayerButton";
+      this.playerButtonDataGridViewTextBoxColumn.FillWeight = 260F;
+      this.playerButtonDataGridViewTextBoxColumn.HeaderText = "Mapped to";
+      this.playerButtonDataGridViewTextBoxColumn.Name = "playerButtonDataGridViewTextBoxColumn";
+      this.playerButtonDataGridViewTextBoxColumn.Width = 260;
+      // 
+      // cecButtonConfigBindingSource
+      // 
+      this.cecButtonConfigBindingSource.DataSource = typeof(CecConfigGui.CecButtonConfig);
+      // 
+      // tbTestCommands
+      // 
+      this.tbTestCommands.Controls.Add(this.bActivateSource);
+      this.tbTestCommands.Controls.Add(this.bScan);
+      this.tbTestCommands.Controls.Add(this.bStandby);
+      this.tbTestCommands.Controls.Add(this.bSendImageViewOn);
+      this.tbTestCommands.Controls.Add(this.lDestination);
+      this.tbTestCommands.Controls.Add(this.cbCommandDestination);
+      this.tbTestCommands.Location = new System.Drawing.Point(4, 22);
+      this.tbTestCommands.Name = "tbTestCommands";
+      this.tbTestCommands.Padding = new System.Windows.Forms.Padding(3);
+      this.tbTestCommands.Size = new System.Drawing.Size(592, 359);
+      this.tbTestCommands.TabIndex = 3;
+      this.tbTestCommands.Text = "CEC tester";
+      this.tbTestCommands.UseVisualStyleBackColor = true;
+      // 
+      // bActivateSource
+      // 
+      this.bActivateSource.Location = new System.Drawing.Point(7, 90);
+      this.bActivateSource.Name = "bActivateSource";
+      this.bActivateSource.Size = new System.Drawing.Size(150, 23);
+      this.bActivateSource.TabIndex = 5;
+      this.bActivateSource.Text = "Activate source";
+      this.bActivateSource.UseVisualStyleBackColor = true;
+      this.bActivateSource.Click += new System.EventHandler(this.bActivateSource_Click);
+      // 
+      // bScan
+      // 
+      this.bScan.Location = new System.Drawing.Point(7, 61);
+      this.bScan.Name = "bScan";
+      this.bScan.Size = new System.Drawing.Size(150, 23);
+      this.bScan.TabIndex = 4;
+      this.bScan.Text = "Device information";
+      this.bScan.UseVisualStyleBackColor = true;
+      this.bScan.Click += new System.EventHandler(this.bScan_Click);
+      // 
+      // bStandby
+      // 
+      this.bStandby.Location = new System.Drawing.Point(7, 32);
+      this.bStandby.Name = "bStandby";
+      this.bStandby.Size = new System.Drawing.Size(150, 23);
+      this.bStandby.TabIndex = 3;
+      this.bStandby.Text = "Standby";
+      this.bStandby.UseVisualStyleBackColor = true;
+      this.bStandby.Click += new System.EventHandler(this.bStandby_Click);
+      // 
+      // bSendImageViewOn
+      // 
+      this.bSendImageViewOn.Location = new System.Drawing.Point(7, 3);
+      this.bSendImageViewOn.Name = "bSendImageViewOn";
+      this.bSendImageViewOn.Size = new System.Drawing.Size(150, 23);
+      this.bSendImageViewOn.TabIndex = 2;
+      this.bSendImageViewOn.Text = "Image view on";
+      this.bSendImageViewOn.UseVisualStyleBackColor = true;
+      this.bSendImageViewOn.Click += new System.EventHandler(this.bSendImageViewOn_Click);
+      // 
+      // lDestination
+      // 
+      this.lDestination.AutoSize = true;
+      this.lDestination.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lDestination.Location = new System.Drawing.Point(420, 3);
+      this.lDestination.Name = "lDestination";
+      this.lDestination.Size = new System.Drawing.Size(138, 24);
+      this.lDestination.TabIndex = 1;
+      this.lDestination.Text = "Target device";
+      // 
+      // cbCommandDestination
+      // 
+      this.cbCommandDestination.FormattingEnabled = true;
+      this.cbCommandDestination.Items.AddRange(new object[] {
+            "0: TV",
+            "1: Recorder 1",
+            "2: Recorder 2",
+            "3: Tuner 1",
+            "4: Playback 1",
+            "5: Audio system",
+            "6: Tuner 2",
+            "7: Tuner 3",
+            "8: Playback 2",
+            "9: Recorder 3",
+            "A: Tuner 4",
+            "B: Playback 3",
+            "C: Reserved 1",
+            "D: Reserved 2",
+            "E: Free use",
+            "F: Broadcast"});
+      this.cbCommandDestination.Location = new System.Drawing.Point(437, 30);
+      this.cbCommandDestination.Name = "cbCommandDestination";
+      this.cbCommandDestination.Size = new System.Drawing.Size(121, 21);
+      this.cbCommandDestination.TabIndex = 0;
+      this.cbCommandDestination.Text = "0: TV";
+      // 
       // LogOutput
       // 
       this.LogOutput.Controls.Add(this.bSaveLog);
       this.lStatus.TabIndex = 2;
       this.lStatus.Text = "Initialising...";
       // 
-      // cecButtonConfigBindingSource
-      // 
-      this.cecButtonConfigBindingSource.DataSource = typeof(CecConfigGui.CecButtonConfig);
-      // 
-      // CecButtonName
-      // 
-      this.CecButtonName.DataPropertyName = "CecButtonName";
-      this.CecButtonName.FillWeight = 260F;
-      this.CecButtonName.HeaderText = "Button";
-      this.CecButtonName.Name = "CecButtonName";
-      this.CecButtonName.ReadOnly = true;
-      this.CecButtonName.Width = 260;
-      // 
-      // playerButtonDataGridViewTextBoxColumn
-      // 
-      this.playerButtonDataGridViewTextBoxColumn.DataPropertyName = "PlayerButton";
-      this.playerButtonDataGridViewTextBoxColumn.FillWeight = 260F;
-      this.playerButtonDataGridViewTextBoxColumn.HeaderText = "Mapped to";
-      this.playerButtonDataGridViewTextBoxColumn.Name = "playerButtonDataGridViewTextBoxColumn";
-      this.playerButtonDataGridViewTextBoxColumn.Width = 260;
-      // 
       // CecConfigGUI
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.Configuration.PerformLayout();
       this.tbButtons.ResumeLayout(false);
       ((System.ComponentModel.ISupportInitialize)(this.dgButtons)).EndInit();
+      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).EndInit();
+      this.tbTestCommands.ResumeLayout(false);
+      this.tbTestCommands.PerformLayout();
       this.LogOutput.ResumeLayout(false);
       this.LogOutput.PerformLayout();
-      ((System.ComponentModel.ISupportInitialize)(this.cecButtonConfigBindingSource)).EndInit();
       this.ResumeLayout(false);
       this.PerformLayout();
 
     private System.Windows.Forms.BindingSource cecButtonConfigBindingSource;
     private System.Windows.Forms.DataGridViewTextBoxColumn CecButtonName;
     private System.Windows.Forms.DataGridViewTextBoxColumn playerButtonDataGridViewTextBoxColumn;
+    private System.Windows.Forms.TabPage tbTestCommands;
+    private System.Windows.Forms.ComboBox cbCommandDestination;
+    private System.Windows.Forms.Button bStandby;
+    private System.Windows.Forms.Button bSendImageViewOn;
+    private System.Windows.Forms.Label lDestination;
+    private System.Windows.Forms.Button bActivateSource;
+    private System.Windows.Forms.Button bScan;
   }
 }
\ No newline at end of file
index 031c7e8fe4cb32f6506ae1a19b1329a1cd620719..a75f6c4e0590dd8e340466ba0584fa2501fbb5bd 100644 (file)
@@ -681,6 +681,91 @@ namespace CecConfigGui
       if (data == null || !data.Enabled)
         e.CellStyle.ForeColor = Color.Gray;
     }
+
+    private CecLogicalAddress GetTargetDevice()
+    {
+      switch (this.cbCommandDestination.Text.Substring(0, 1).ToLower())
+      {
+        case "0":
+          return CecLogicalAddress.Tv;
+        case "1":
+          return CecLogicalAddress.RecordingDevice1;
+        case "2":
+          return CecLogicalAddress.RecordingDevice2;
+        case "3":
+          return CecLogicalAddress.Tuner1;
+        case "4":
+          return CecLogicalAddress.PlaybackDevice1;
+        case "5":
+          return CecLogicalAddress.AudioSystem;
+        case "6":
+          return CecLogicalAddress.Tuner2;
+        case "7":
+          return CecLogicalAddress.Tuner3;
+        case "8":
+          return CecLogicalAddress.PlaybackDevice2;
+        case "9":
+          return CecLogicalAddress.RecordingDevice3;
+        case "a":
+          return CecLogicalAddress.Tuner4;
+        case "b":
+          return CecLogicalAddress.PlaybackDevice3;
+        case "c":
+          return CecLogicalAddress.Reserved1;
+        case "d":
+          return CecLogicalAddress.Reserved2;
+        case "e":
+          return CecLogicalAddress.FreeUse;
+        case "f":
+          return CecLogicalAddress.Broadcast;
+        default:
+          return CecLogicalAddress.Unknown;
+      }
+    }
+
+    private void bSendImageViewOn_Click(object sender, EventArgs e)
+    {
+      if (ActiveProcess == null)
+      {
+        SetControlsEnabled(false);
+        ActiveProcess = new SendImageViewOn(ref Lib, GetTargetDevice());
+        ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
+        (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
+      }
+    }
+
+    private void bStandby_Click(object sender, EventArgs e)
+    {
+      if (ActiveProcess == null)
+      {
+        SetControlsEnabled(false);
+        ActiveProcess = new SendStandby(ref Lib, GetTargetDevice());
+        ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
+        (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
+      }
+    }
+
+    private void bScan_Click(object sender, EventArgs e)
+    {
+      if (ActiveProcess == null)
+      {
+        SetControlsEnabled(false);
+        ActiveProcess = new ShowDeviceInfo(ref Lib, GetTargetDevice());
+        ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
+        (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
+      }
+    }
+
+    private void bActivateSource_Click(object sender, EventArgs e)
+    {
+      if (ActiveProcess == null)
+      {
+        SetControlsEnabled(false);
+        ActiveProcess = new SendActivateSource(ref Lib, GetTargetDevice());
+        ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
+        (new Thread(new ThreadStart(ActiveProcess.Run))).Start();
+      }
+    }
   }
 
   internal class CecCallbackWrapper : CecCallbackMethods
diff --git a/src/cec-config-gui/DeviceInformation.Designer.cs b/src/cec-config-gui/DeviceInformation.Designer.cs
new file mode 100644 (file)
index 0000000..5372431
--- /dev/null
@@ -0,0 +1,308 @@
+namespace CecConfigGui
+{
+  partial class DeviceInformation
+  {
+    /// <summary>
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary>
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing)
+    {
+      if (disposing && (components != null))
+      {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Windows Form Designer generated code
+
+    /// <summary>
+    /// Required method for Designer support - do not modify
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent()
+    {
+      this.label1 = new System.Windows.Forms.Label();
+      this.label2 = new System.Windows.Forms.Label();
+      this.label3 = new System.Windows.Forms.Label();
+      this.label4 = new System.Windows.Forms.Label();
+      this.label5 = new System.Windows.Forms.Label();
+      this.label6 = new System.Windows.Forms.Label();
+      this.label7 = new System.Windows.Forms.Label();
+      this.label8 = new System.Windows.Forms.Label();
+      this.label9 = new System.Windows.Forms.Label();
+      this.label10 = new System.Windows.Forms.Label();
+      this.lMenuLanguage = new System.Windows.Forms.Label();
+      this.lOsdName = new System.Windows.Forms.Label();
+      this.lPowerStatus = new System.Windows.Forms.Label();
+      this.lCecVersion = new System.Windows.Forms.Label();
+      this.lVendor = new System.Windows.Forms.Label();
+      this.lActiveSource = new System.Windows.Forms.Label();
+      this.lDevicePresent = new System.Windows.Forms.Label();
+      this.lPhysicalAddress = new System.Windows.Forms.Label();
+      this.lLogicalAddress = new System.Windows.Forms.Label();
+      this.lDevice = new System.Windows.Forms.Label();
+      this.SuspendLayout();
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label1.Location = new System.Drawing.Point(12, 9);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(47, 13);
+      this.label1.TabIndex = 0;
+      this.label1.Text = "Device";
+      // 
+      // label2
+      // 
+      this.label2.AutoSize = true;
+      this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label2.Location = new System.Drawing.Point(12, 29);
+      this.label2.Name = "label2";
+      this.label2.Size = new System.Drawing.Size(96, 13);
+      this.label2.TabIndex = 1;
+      this.label2.Text = "Logical address";
+      // 
+      // label3
+      // 
+      this.label3.AutoSize = true;
+      this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label3.Location = new System.Drawing.Point(12, 49);
+      this.label3.Name = "label3";
+      this.label3.Size = new System.Drawing.Size(102, 13);
+      this.label3.TabIndex = 2;
+      this.label3.Text = "Physical address";
+      // 
+      // label4
+      // 
+      this.label4.AutoSize = true;
+      this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label4.Location = new System.Drawing.Point(12, 69);
+      this.label4.Name = "label4";
+      this.label4.Size = new System.Drawing.Size(93, 13);
+      this.label4.TabIndex = 3;
+      this.label4.Text = "Device present";
+      // 
+      // label5
+      // 
+      this.label5.AutoSize = true;
+      this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label5.Location = new System.Drawing.Point(12, 89);
+      this.label5.Name = "label5";
+      this.label5.Size = new System.Drawing.Size(85, 13);
+      this.label5.TabIndex = 4;
+      this.label5.Text = "Active source";
+      // 
+      // label6
+      // 
+      this.label6.AutoSize = true;
+      this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label6.Location = new System.Drawing.Point(12, 109);
+      this.label6.Name = "label6";
+      this.label6.Size = new System.Drawing.Size(47, 13);
+      this.label6.TabIndex = 5;
+      this.label6.Text = "Vendor";
+      // 
+      // label7
+      // 
+      this.label7.AutoSize = true;
+      this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label7.Location = new System.Drawing.Point(12, 129);
+      this.label7.Name = "label7";
+      this.label7.Size = new System.Drawing.Size(76, 13);
+      this.label7.TabIndex = 6;
+      this.label7.Text = "CEC version";
+      // 
+      // label8
+      // 
+      this.label8.AutoSize = true;
+      this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label8.Location = new System.Drawing.Point(12, 149);
+      this.label8.Name = "label8";
+      this.label8.Size = new System.Drawing.Size(80, 13);
+      this.label8.TabIndex = 7;
+      this.label8.Text = "Power status";
+      // 
+      // label9
+      // 
+      this.label9.AutoSize = true;
+      this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label9.Location = new System.Drawing.Point(12, 169);
+      this.label9.Name = "label9";
+      this.label9.Size = new System.Drawing.Size(67, 13);
+      this.label9.TabIndex = 8;
+      this.label9.Text = "OSD name";
+      // 
+      // label10
+      // 
+      this.label10.AutoSize = true;
+      this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.label10.Location = new System.Drawing.Point(12, 189);
+      this.label10.Name = "label10";
+      this.label10.Size = new System.Drawing.Size(94, 13);
+      this.label10.TabIndex = 9;
+      this.label10.Text = "Menu language";
+      // 
+      // lMenuLanguage
+      // 
+      this.lMenuLanguage.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lMenuLanguage.Location = new System.Drawing.Point(122, 189);
+      this.lMenuLanguage.Name = "lMenuLanguage";
+      this.lMenuLanguage.Size = new System.Drawing.Size(150, 13);
+      this.lMenuLanguage.TabIndex = 19;
+      this.lMenuLanguage.Text = "unknown";
+      this.lMenuLanguage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lOsdName
+      // 
+      this.lOsdName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lOsdName.Location = new System.Drawing.Point(122, 169);
+      this.lOsdName.Name = "lOsdName";
+      this.lOsdName.Size = new System.Drawing.Size(150, 13);
+      this.lOsdName.TabIndex = 20;
+      this.lOsdName.Text = "unknown";
+      this.lOsdName.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lPowerStatus
+      // 
+      this.lPowerStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lPowerStatus.Location = new System.Drawing.Point(122, 149);
+      this.lPowerStatus.Name = "lPowerStatus";
+      this.lPowerStatus.Size = new System.Drawing.Size(150, 13);
+      this.lPowerStatus.TabIndex = 21;
+      this.lPowerStatus.Text = "unknown";
+      this.lPowerStatus.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lCecVersion
+      // 
+      this.lCecVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lCecVersion.Location = new System.Drawing.Point(122, 129);
+      this.lCecVersion.Name = "lCecVersion";
+      this.lCecVersion.Size = new System.Drawing.Size(150, 13);
+      this.lCecVersion.TabIndex = 22;
+      this.lCecVersion.Text = "unknown";
+      this.lCecVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lVendor
+      // 
+      this.lVendor.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lVendor.Location = new System.Drawing.Point(122, 109);
+      this.lVendor.Name = "lVendor";
+      this.lVendor.Size = new System.Drawing.Size(150, 13);
+      this.lVendor.TabIndex = 23;
+      this.lVendor.Text = "unknown";
+      this.lVendor.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lActiveSource
+      // 
+      this.lActiveSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lActiveSource.Location = new System.Drawing.Point(122, 89);
+      this.lActiveSource.Name = "lActiveSource";
+      this.lActiveSource.Size = new System.Drawing.Size(150, 13);
+      this.lActiveSource.TabIndex = 24;
+      this.lActiveSource.Text = "unknown";
+      this.lActiveSource.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lDevicePresent
+      // 
+      this.lDevicePresent.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lDevicePresent.Location = new System.Drawing.Point(122, 69);
+      this.lDevicePresent.Name = "lDevicePresent";
+      this.lDevicePresent.Size = new System.Drawing.Size(150, 13);
+      this.lDevicePresent.TabIndex = 25;
+      this.lDevicePresent.Text = "unknown";
+      this.lDevicePresent.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lPhysicalAddress
+      // 
+      this.lPhysicalAddress.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lPhysicalAddress.Location = new System.Drawing.Point(122, 49);
+      this.lPhysicalAddress.Name = "lPhysicalAddress";
+      this.lPhysicalAddress.Size = new System.Drawing.Size(150, 13);
+      this.lPhysicalAddress.TabIndex = 26;
+      this.lPhysicalAddress.Text = "unknown";
+      this.lPhysicalAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lLogicalAddress
+      // 
+      this.lLogicalAddress.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lLogicalAddress.Location = new System.Drawing.Point(122, 29);
+      this.lLogicalAddress.Name = "lLogicalAddress";
+      this.lLogicalAddress.Size = new System.Drawing.Size(150, 13);
+      this.lLogicalAddress.TabIndex = 27;
+      this.lLogicalAddress.Text = "unknown";
+      this.lLogicalAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // lDevice
+      // 
+      this.lDevice.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.lDevice.Location = new System.Drawing.Point(122, 9);
+      this.lDevice.Name = "lDevice";
+      this.lDevice.Size = new System.Drawing.Size(150, 13);
+      this.lDevice.TabIndex = 28;
+      this.lDevice.Text = "unknown";
+      this.lDevice.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+      // 
+      // DeviceInformation
+      // 
+      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.ClientSize = new System.Drawing.Size(284, 218);
+      this.Controls.Add(this.lDevice);
+      this.Controls.Add(this.lLogicalAddress);
+      this.Controls.Add(this.lPhysicalAddress);
+      this.Controls.Add(this.lDevicePresent);
+      this.Controls.Add(this.lActiveSource);
+      this.Controls.Add(this.lVendor);
+      this.Controls.Add(this.lCecVersion);
+      this.Controls.Add(this.lPowerStatus);
+      this.Controls.Add(this.lOsdName);
+      this.Controls.Add(this.lMenuLanguage);
+      this.Controls.Add(this.label10);
+      this.Controls.Add(this.label9);
+      this.Controls.Add(this.label8);
+      this.Controls.Add(this.label7);
+      this.Controls.Add(this.label6);
+      this.Controls.Add(this.label5);
+      this.Controls.Add(this.label4);
+      this.Controls.Add(this.label3);
+      this.Controls.Add(this.label2);
+      this.Controls.Add(this.label1);
+      this.Name = "DeviceInformation";
+      this.Text = "Device: [unknown]";
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+
+    #endregion
+
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.Label label2;
+    private System.Windows.Forms.Label label3;
+    private System.Windows.Forms.Label label4;
+    private System.Windows.Forms.Label label5;
+    private System.Windows.Forms.Label label6;
+    private System.Windows.Forms.Label label7;
+    private System.Windows.Forms.Label label8;
+    private System.Windows.Forms.Label label9;
+    private System.Windows.Forms.Label label10;
+    private System.Windows.Forms.Label lMenuLanguage;
+    private System.Windows.Forms.Label lOsdName;
+    private System.Windows.Forms.Label lPowerStatus;
+    private System.Windows.Forms.Label lCecVersion;
+    private System.Windows.Forms.Label lVendor;
+    private System.Windows.Forms.Label lActiveSource;
+    private System.Windows.Forms.Label lDevicePresent;
+    private System.Windows.Forms.Label lPhysicalAddress;
+    private System.Windows.Forms.Label lLogicalAddress;
+    private System.Windows.Forms.Label lDevice;
+  }
+}
\ No newline at end of file
diff --git a/src/cec-config-gui/DeviceInformation.cs b/src/cec-config-gui/DeviceInformation.cs
new file mode 100644 (file)
index 0000000..9d9b983
--- /dev/null
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using CecSharp;
+
+namespace CecConfigGui
+{
+  public partial class DeviceInformation : Form
+  {
+    public DeviceInformation(CecLogicalAddress address, ref LibCecSharp lib,
+      bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
+      CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
+    {
+      InitializeComponent();
+      this.lDevice.Text = lib.ToString(address);
+      this.lLogicalAddress.Text = "#" + (int)address;
+      this.lPhysicalAddress.Text = physicalAddress.ToString();
+      this.lDevicePresent.Text = devicePresent ? "yes" : "no";
+      this.lActiveSource.Text = isActiveSource ? "yes" : "no";
+      this.lVendor.Text = lib.ToString(vendor) + " (" + (UInt64)vendor +")";
+      this.lCecVersion.Text = lib.ToString(version);
+      this.lPowerStatus.Text = lib.ToString(power);
+      this.lOsdName.Text = osdName;
+      this.lMenuLanguage.Text = menuLanguage;
+    }
+  }
+}
diff --git a/src/cec-config-gui/DeviceInformation.resx b/src/cec-config-gui/DeviceInformation.resx
new file mode 100644 (file)
index 0000000..19dc0dd
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>
\ No newline at end of file
diff --git a/src/cec-config-gui/actions/SendActivateSource.cs b/src/cec-config-gui/actions/SendActivateSource.cs
new file mode 100644 (file)
index 0000000..e60c0a5
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using CecSharp;
+
+namespace CecConfigGui.actions
+{
+  class SendActivateSource : UpdateProcess
+  {
+    public SendActivateSource(ref LibCecSharp lib, CecLogicalAddress address)
+    {
+      Lib = lib;
+      Address = address;
+    }
+
+    public override void Process()
+    {
+      SendEvent(UpdateEventType.StatusText, "Sending the 'activate source' command to " + Lib.ToString(Address) + "...");
+      SendEvent(UpdateEventType.ProgressBar, 50);
+
+      bool bResult = Lib.SetStreamPath(Address);
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.ProgressBar, 100);
+    }
+
+    private LibCecSharp Lib;
+    private CecLogicalAddress Address;
+  }
+}
diff --git a/src/cec-config-gui/actions/SendImageViewOn.cs b/src/cec-config-gui/actions/SendImageViewOn.cs
new file mode 100644 (file)
index 0000000..26d9534
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using CecSharp;
+
+namespace CecConfigGui.actions
+{
+  class SendImageViewOn : UpdateProcess
+  {
+    public SendImageViewOn(ref LibCecSharp lib, CecLogicalAddress address)
+    {
+      Lib = lib;
+      Address = address;
+    }
+
+    public override void Process()
+    {
+      SendEvent(UpdateEventType.StatusText, "Sending the 'power on' command to " + Lib.ToString(Address) + "...");
+      SendEvent(UpdateEventType.ProgressBar, 50);
+
+      bool bResult = Lib.PowerOnDevices(Address);
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.ProgressBar, 100);
+    }
+
+    private LibCecSharp Lib;
+    private CecLogicalAddress Address;
+  }
+}
diff --git a/src/cec-config-gui/actions/SendStandby.cs b/src/cec-config-gui/actions/SendStandby.cs
new file mode 100644 (file)
index 0000000..9eb8afb
--- /dev/null
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using CecSharp;
+
+namespace CecConfigGui.actions
+{
+  class SendStandby : UpdateProcess
+  {
+    public SendStandby(ref LibCecSharp lib, CecLogicalAddress address)
+    {
+      Lib = lib;
+      Address = address;
+    }
+
+    public override void Process()
+    {
+      SendEvent(UpdateEventType.StatusText, "Sending the 'standby' command to " + Lib.ToString(Address) + "...");
+      SendEvent(UpdateEventType.ProgressBar, 50);
+
+      bool bResult = Lib.StandbyDevices(Address);
+      SendEvent(UpdateEventType.StatusText, bResult ? "Command sent successfully." : "The device could not be powered on.");
+      SendEvent(UpdateEventType.ProgressBar, 100);
+    }
+
+    private LibCecSharp Lib;
+    private CecLogicalAddress Address;
+  }
+}
diff --git a/src/cec-config-gui/actions/ShowDeviceInfo.cs b/src/cec-config-gui/actions/ShowDeviceInfo.cs
new file mode 100644 (file)
index 0000000..61dd35f
--- /dev/null
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using CecSharp;
+
+namespace CecConfigGui.actions
+{
+  class ShowDeviceInfo : UpdateProcess
+  {
+    public ShowDeviceInfo(ref LibCecSharp lib, CecLogicalAddress address)
+    {
+      Lib = lib;
+      Address = address;
+    }
+
+    public override void Process()
+    {
+      CecVendorId vendor = CecVendorId.Unknown;
+      bool isActiveSource = false;
+      ushort physicalAddress = 0xFFFF;
+      CecVersion version = CecVersion.Unknown;
+      CecPowerStatus power = CecPowerStatus.Unknown;
+      string osdName = "unknown";
+      string menuLanguage = "unknown";
+
+      SendEvent(UpdateEventType.StatusText, "Checking device presense...");
+      SendEvent(UpdateEventType.ProgressBar, 10);
+
+      bool devicePresent = Lib.IsActiveDevice(Address);
+      if (devicePresent)
+      {
+        SendEvent(UpdateEventType.StatusText, "Requesting the vendor ID...");
+        SendEvent(UpdateEventType.ProgressBar, 20);
+        vendor = Lib.GetDeviceVendorId(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting active source state...");
+        SendEvent(UpdateEventType.ProgressBar, 30);
+        isActiveSource = Lib.IsActiveSource(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting physical address...");
+        SendEvent(UpdateEventType.ProgressBar, 40);
+        physicalAddress = Lib.GetDevicePhysicalAddress(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting CEC version...");
+        SendEvent(UpdateEventType.ProgressBar, 50);
+        version = Lib.GetDeviceCecVersion(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting power status...");
+        SendEvent(UpdateEventType.ProgressBar, 60);
+        power = Lib.GetDevicePowerStatus(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting OSD name...");
+        SendEvent(UpdateEventType.ProgressBar, 70);
+        osdName = Lib.GetDeviceOSDName(Address);
+
+        SendEvent(UpdateEventType.StatusText, "Requesting menu language...");
+        SendEvent(UpdateEventType.ProgressBar, 80);
+        menuLanguage = Lib.GetDeviceMenuLanguage(Address);
+      }
+
+      SendEvent(UpdateEventType.StatusText, "Showing device information");
+      SendEvent(UpdateEventType.ProgressBar, 90);
+
+      DeviceInformation di = new DeviceInformation(Address, ref Lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
+      di.ShowDialog();
+
+      SendEvent(UpdateEventType.StatusText, "Ready.");
+      SendEvent(UpdateEventType.ProgressBar, 100);
+    }
+
+    private LibCecSharp Lib;
+    private CecLogicalAddress Address;
+  }
+}
index 29237476d998e01211e4501b2ca046770b3f5fce..4b83aaac6a6dd129af6286eaf53645b0f0e19f72 100644 (file)
   </ItemGroup>
   <ItemGroup>
     <Compile Include="actions\ConnectToDevice.cs" />
+    <Compile Include="actions\SendActivateSource.cs" />
+    <Compile Include="actions\SendImageViewOn.cs" />
+    <Compile Include="actions\SendStandby.cs" />
+    <Compile Include="actions\ShowDeviceInfo.cs" />
     <Compile Include="actions\UpdateConnectedDevice.cs" />
     <Compile Include="actions\UpdatePhysicalAddress.cs" />
     <Compile Include="CecButtonConfig.cs" />
     <Compile Include="CecConfigGUI.Designer.cs">
       <DependentUpon>CecConfigGUI.cs</DependentUpon>
     </Compile>
+    <Compile Include="DeviceInformation.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="DeviceInformation.Designer.cs">
+      <DependentUpon>DeviceInformation.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="CecConfigGUI.resx">
       <DependentUpon>CecConfigGUI.cs</DependentUpon>
       <SubType>Designer</SubType>
     </EmbeddedResource>
+    <EmbeddedResource Include="DeviceInformation.resx">
+      <DependentUpon>DeviceInformation.cs</DependentUpon>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>