# HG changeset patch # User sl # Date 1398074558 -7200 # Node ID 328515997e3517e1a1c5ae6706f025ba44460282 # Parent d5f6b2119a13b19d456ced0029e99a31a22bbb4b Adding first draft of our text application. This is most useful for testing stuff without MediaPortal. diff -r d5f6b2119a13 -r 328515997e35 IdwTest/App.config --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/App.config Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Idw.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Idw.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,358 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace iMON +{ + class Display + { + public string StatusMessage { get; set; } + public DSPType Type { get; set; } + public bool IsLcd() { return Type == DSPType.DSPN_DSP_LCD; } + public bool IsVfd() { return Type == DSPType.DSPN_DSP_VFD; } + public string Name() + { + if (Type == DSPType.DSPN_DSP_VFD) + { + return "SoundGraph iMON VFD"; + } + else if (Type == DSPType.DSPN_DSP_LCD) + { + return "SoundGraph iMON LCD"; + } + else //(DisplayType == DSPType.DSPN_DSP_NONE) + { + return "No display"; + } + } + + /// + /// Do display initialization. + /// Returns true on success + /// + public bool DoInit() + { + IDW_INITRESULT initResult = new IDW_INITRESULT(); + DSPResult ret = IDW_Init(initResult); + //Check the API call worked + if (ret != DSPResult.DSP_SUCCEEDED) + { + StatusMessage = DSPResult2String(ret); + return false; + } + //Check that the initialization was carried out properly + else if (initResult.iInitResult != DSPNInitResult.DSPN_SUCCEEDED) + { + StatusMessage = DSPNResult2String(initResult.iInitResult); + return false; + } + //Check we that we have a display + else if (initResult.iDspType == DSPType.DSPN_DSP_NONE) + { + StatusMessage = "Unsupported device"; + return false; + } + + Type = initResult.iDspType; + return true; + } + + /// + /// Do display de-initialization. + /// Returns true on success + /// + public void DoUninit() + { + Type = DSPType.DSPN_DSP_NONE; + IDW_Uninit(); + } + + + /// + /// Provide a string corresponding to the given DSPResult. + /// + protected string DSPResult2String(DSPResult result) + { + switch (result) + { + case DSPResult.DSP_SUCCEEDED: + return "Success"; + case DSPResult.DSP_E_FAIL: + return "An unknown error occurred"; + case DSPResult.DSP_E_OUTOFMEMORY: + return "Out of memory"; + case DSPResult.DSP_E_INVALIDARG: + return "One or more arguments are invalid"; + case DSPResult.DSP_E_NOT_INITED: + return "API is not initialized"; + case DSPResult.DSP_E_POINTER: + return "Pointer is invalid"; + default: + return "An unknown error occurred"; + } + } + + /// + /// Provide a string corresponding to the given DSPNInitResult. + /// + protected string DSPNResult2String(DSPNInitResult result) + { + switch (result) + { + case DSPNInitResult.DSPN_SUCCEEDED: + return "Success"; + case DSPNInitResult.DSPN_ERR_IN_USE: + return "Display plug-in is already used by another application"; + case DSPNInitResult.DSPN_ERR_HW_DISCONNECTED: + return "iMON hardware is not connected"; + case DSPNInitResult.DSPN_ERR_NOT_SUPPORTED_HW: + return "The connected hardware does not support the plug-in mode"; + case DSPNInitResult.DSPN_ERR_PLUGIN_DISABLED: + return "The plug-in mode option is disabled"; + case DSPNInitResult.DSPN_ERR_IMON_NO_REPLY: + return "The latest iMON is not installed or iMON is not running"; + default: + return "An unknown error occurred"; + } + } + + //Possible return values from iMON Display APIs + public enum DSPResult : int + { + DSP_SUCCEEDED = 0, + DSP_E_FAIL = 1, + DSP_E_OUTOFMEMORY = 2, + DSP_E_INVALIDARG = 3, + DSP_E_NOT_INITED = 4, + DSP_E_POINTER = 5, + DSP_S_INITED = 0x1000, + DSP_S_NOT_INITED = 0x1001, + DSP_S_IN_PLUGIN_MODE = 0x1002, + DSP_S_NOT_IN_PLUGIN_MODE = 0x1003 + } + + //Possible results from display initialization + public enum DSPNInitResult : int + { + DSPN_SUCCEEDED = 0, + DSPN_ERR_IN_USE = 0x0100, + DSPN_ERR_HW_DISCONNECTED = 0x0101, + DSPN_ERR_NOT_SUPPORTED_HW = 0x0102, + DSPN_ERR_PLUGIN_DISABLED = 0x0103, + DSPN_ERR_IMON_NO_REPLY = 0x0104, + DSPN_ERR_UNKNOWN = 0x0200 + } + + //Type of display + public enum DSPType : int + { + DSPN_DSP_NONE = 0, + DSPN_DSP_VFD = 0x01, + DSPN_DSP_LCD = 0x02 + }; + + //Notification code + public enum DSPNotifyCode : int + { + DSPNM_PLUGIN_SUCCEED = 0, + DSPNM_PLUGIN_FAILED, + DSPNM_IMON_RESTARTED, + DSPNM_IMON_CLOSED, + DSPNM_HW_CONNECTED, + DSPNM_HW_DISCONNECTED, + DSPNM_LCD_TEXT_SCROLL_DONE = 0x1000 + }; + + [Flags] + public enum OrangeDiskPieces : byte + { + Piece1 = 0x80, // top piece + Piece2 = 0x40, // next piece counter-clockwise + Piece3 = 0x20, // and so on... + Piece4 = 0x10, + Piece5 = 0x8, + Piece6 = 0x4, + Piece7 = 0x2, + Piece8 = 0x1, + None = 0x0 + } + + public enum OrangeDiskIcon : byte + { + On = 0x80, + Off = 0x0 + } + + [Flags] + public enum MediaTypes : byte + { + Music = 0x80, + Movie = 0x40, + Photo = 0x20, + Cd_Dvd = 0x10, + Tv = 0x8, + WebCasting = 0x4, + News_Weather = 0x2, + None = 0x0 + } + + [Flags] + public enum Speakers : byte + { + L = 0x80, + C = 0x40, + R = 0x20, + SL = 0x10, + LFE = 0x8, + SR = 0x4, + RL = 0x2, + SPDIF = 0x1, + None = 0x0 + } + + public enum SpeakersRR : byte + { + RR = 0x80, + Off = 0x0 + } + + [Flags] + public enum VideoCodecs : byte + { + MPG = 0x80, + DIVX = 0x40, + XVID = 0x20, + WMV = 0x10, + MPG2 = 0x8, + AC3 = 0x4, + DTS = 0x2, + WMA = 0x1, + None = 0x0 + } + + [Flags] + public enum AudioCodecs : byte + { + MP3 = 0x80, + OGG = 0x40, + WMA = 0x20, + WAV = 0x10, + None = 0x0 + } + + [Flags] + public enum AspectRatios : byte + { + SRC = 0x80, + FIT = 0x40, + TV = 0x20, + HDTV = 0x10, + SCR1 = 0x8, + SCR2 = 0x4, + None = 0x0 + } + + [Flags] + public enum EtcIcons : byte + { + Repeat = 0x80, + Shuffle = 0x40, + Alarm = 0x20, + Recording = 0x10, + Volume = 0x8, + Time = 0x4, + None = 0x0 + } + + //Provide results from our iMON Display initialization + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)] + protected class IDW_INITRESULT + { + [MarshalAs(UnmanagedType.U4)] + public DSPNotifyCode iNotification; + [MarshalAs(UnmanagedType.U4)] + public DSPNInitResult iInitResult; + [MarshalAs(UnmanagedType.U4)] + public DSPType iDspType; + } + + //Provide result for our status query + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 8)] + protected class IDW_STATUS + { + [MarshalAs(UnmanagedType.U4)] + public DSPNotifyCode iNotification; + } + + //Declare a struct to pass our EqData + [StructLayout(LayoutKind.Sequential)] + public class DSPEQDATA + { + public DSPEQDATA() + { + BandData = new int[16]; + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public readonly int[] BandData; + } + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + protected static extern DSPResult IDW_Init(IDW_INITRESULT initResult); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + protected static extern DSPResult IDW_Uninit(); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + protected static extern DSPResult IDW_IsInitialized(); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + protected static extern DSPResult IDW_GetStatus(IDW_STATUS status); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetVfdText([MarshalAs(UnmanagedType.LPWStr)] string line1, [MarshalAs(UnmanagedType.LPWStr)] string line2); + + //Import function to set VFD EQDATA + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern int IDW_SetVfdEqData(DSPEQDATA EqData); + + //Import function to set LCD EQDATA + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern int IDW_SetLcdEqData(DSPEQDATA EqDataLeft, DSPEQDATA EqDataRight); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdText([MarshalAs(UnmanagedType.LPWStr)] string line); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdAllIcons([MarshalAs(UnmanagedType.Bool)] bool on); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdOrangeIcon(byte iconData1, byte iconData2); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdMediaTypeIcon(byte iconData); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdSpeakerIcon(byte iconData1, byte iconData2); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdVideoCodecIcon(byte iconData); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdAudioCodecIcon(byte iconData); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdAspectRatioIcon(byte iconData); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdEtcIcon(byte iconData); + + [DllImport("iMONDisplayWrapper.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern DSPResult IDW_SetLcdProgress(int currentPosition, int total); + + + } +} diff -r d5f6b2119a13 -r 328515997e35 IdwTest/IdwTest.csproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/IdwTest.csproj Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {8E8FEBA2-486D-450F-84A1-09EB7E28F499} + WinExe + Properties + IdwTest + IdwTest + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + MainForm.cs + + + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff -r d5f6b2119a13 -r 328515997e35 IdwTest/IdwTest.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/IdwTest.sln Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdwTest", "IdwTest.csproj", "{8E8FEBA2-486D-450F-84A1-09EB7E28F499}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E8FEBA2-486D-450F-84A1-09EB7E28F499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E8FEBA2-486D-450F-84A1-09EB7E28F499}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E8FEBA2-486D-450F-84A1-09EB7E28F499}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E8FEBA2-486D-450F-84A1-09EB7E28F499}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r d5f6b2119a13 -r 328515997e35 IdwTest/MainForm.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/MainForm.Designer.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,290 @@ +namespace IdwTest +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonInit = new System.Windows.Forms.Button(); + this.buttonUninit = new System.Windows.Forms.Button(); + this.labelStatus = new System.Windows.Forms.Label(); + this.textBoxVfdTop = new System.Windows.Forms.TextBox(); + this.textBoxVfdBottom = new System.Windows.Forms.TextBox(); + this.groupBoxVfd = new System.Windows.Forms.GroupBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.buttonSetVfdText = new System.Windows.Forms.Button(); + this.groupBoxLcd = new System.Windows.Forms.GroupBox(); + this.textBoxLcd = new System.Windows.Forms.TextBox(); + this.buttonSetLcdText = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.buttonToggleTimer = new System.Windows.Forms.Button(); + this.groupBoxTimer = new System.Windows.Forms.GroupBox(); + this.label4 = new System.Windows.Forms.Label(); + this.numericTimerInterval = new System.Windows.Forms.NumericUpDown(); + this.checkBoxRandomEq = new System.Windows.Forms.CheckBox(); + this.groupBoxVfd.SuspendLayout(); + this.groupBoxLcd.SuspendLayout(); + this.groupBoxTimer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericTimerInterval)).BeginInit(); + this.SuspendLayout(); + // + // buttonInit + // + this.buttonInit.Location = new System.Drawing.Point(12, 12); + this.buttonInit.Name = "buttonInit"; + this.buttonInit.Size = new System.Drawing.Size(75, 23); + this.buttonInit.TabIndex = 0; + this.buttonInit.Text = "Init"; + this.buttonInit.UseVisualStyleBackColor = true; + this.buttonInit.Click += new System.EventHandler(this.buttonInit_Click); + // + // buttonUninit + // + this.buttonUninit.Location = new System.Drawing.Point(93, 12); + this.buttonUninit.Name = "buttonUninit"; + this.buttonUninit.Size = new System.Drawing.Size(75, 23); + this.buttonUninit.TabIndex = 1; + this.buttonUninit.Text = "Uninit"; + this.buttonUninit.UseVisualStyleBackColor = true; + this.buttonUninit.Click += new System.EventHandler(this.buttonUninit_Click); + // + // labelStatus + // + this.labelStatus.AutoSize = true; + this.labelStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelStatus.Location = new System.Drawing.Point(174, 15); + this.labelStatus.Name = "labelStatus"; + this.labelStatus.Size = new System.Drawing.Size(113, 20); + this.labelStatus.TabIndex = 2; + this.labelStatus.Text = "Not connected"; + // + // textBoxVfdTop + // + this.textBoxVfdTop.Location = new System.Drawing.Point(94, 19); + this.textBoxVfdTop.MaxLength = 16; + this.textBoxVfdTop.Name = "textBoxVfdTop"; + this.textBoxVfdTop.Size = new System.Drawing.Size(100, 20); + this.textBoxVfdTop.TabIndex = 3; + // + // textBoxVfdBottom + // + this.textBoxVfdBottom.Location = new System.Drawing.Point(94, 45); + this.textBoxVfdBottom.Name = "textBoxVfdBottom"; + this.textBoxVfdBottom.Size = new System.Drawing.Size(100, 20); + this.textBoxVfdBottom.TabIndex = 4; + // + // groupBoxVfd + // + this.groupBoxVfd.Controls.Add(this.label2); + this.groupBoxVfd.Controls.Add(this.label1); + this.groupBoxVfd.Controls.Add(this.buttonSetVfdText); + this.groupBoxVfd.Controls.Add(this.textBoxVfdTop); + this.groupBoxVfd.Controls.Add(this.textBoxVfdBottom); + this.groupBoxVfd.Location = new System.Drawing.Point(12, 41); + this.groupBoxVfd.Name = "groupBoxVfd"; + this.groupBoxVfd.Size = new System.Drawing.Size(200, 100); + this.groupBoxVfd.TabIndex = 5; + this.groupBoxVfd.TabStop = false; + this.groupBoxVfd.Text = "VFD"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 48); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(85, 13); + this.label2.TabIndex = 7; + this.label2.Text = "Text bottom line:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(7, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(68, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Text top line:"; + // + // buttonSetVfdText + // + this.buttonSetVfdText.Location = new System.Drawing.Point(119, 71); + this.buttonSetVfdText.Name = "buttonSetVfdText"; + this.buttonSetVfdText.Size = new System.Drawing.Size(75, 23); + this.buttonSetVfdText.TabIndex = 5; + this.buttonSetVfdText.Text = "Update"; + this.buttonSetVfdText.UseVisualStyleBackColor = true; + // + // groupBoxLcd + // + this.groupBoxLcd.Controls.Add(this.textBoxLcd); + this.groupBoxLcd.Controls.Add(this.buttonSetLcdText); + this.groupBoxLcd.Controls.Add(this.label3); + this.groupBoxLcd.Location = new System.Drawing.Point(218, 41); + this.groupBoxLcd.Name = "groupBoxLcd"; + this.groupBoxLcd.Size = new System.Drawing.Size(200, 100); + this.groupBoxLcd.TabIndex = 6; + this.groupBoxLcd.TabStop = false; + this.groupBoxLcd.Text = "LCD"; + // + // textBoxLcd + // + this.textBoxLcd.Location = new System.Drawing.Point(94, 19); + this.textBoxLcd.Name = "textBoxLcd"; + this.textBoxLcd.Size = new System.Drawing.Size(100, 20); + this.textBoxLcd.TabIndex = 2; + // + // buttonSetLcdText + // + this.buttonSetLcdText.Location = new System.Drawing.Point(119, 71); + this.buttonSetLcdText.Name = "buttonSetLcdText"; + this.buttonSetLcdText.Size = new System.Drawing.Size(75, 23); + this.buttonSetLcdText.TabIndex = 1; + this.buttonSetLcdText.Text = "Update"; + this.buttonSetLcdText.UseVisualStyleBackColor = true; + this.buttonSetLcdText.Click += new System.EventHandler(this.buttonSetLcdText_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 22); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(28, 13); + this.label3.TabIndex = 0; + this.label3.Text = "Text"; + // + // buttonToggleTimer + // + this.buttonToggleTimer.Location = new System.Drawing.Point(119, 71); + this.buttonToggleTimer.Name = "buttonToggleTimer"; + this.buttonToggleTimer.Size = new System.Drawing.Size(75, 23); + this.buttonToggleTimer.TabIndex = 3; + this.buttonToggleTimer.Text = "Start"; + this.buttonToggleTimer.UseVisualStyleBackColor = true; + this.buttonToggleTimer.Click += new System.EventHandler(this.buttonToggleTimer_Click); + // + // groupBoxTimer + // + this.groupBoxTimer.Controls.Add(this.checkBoxRandomEq); + this.groupBoxTimer.Controls.Add(this.numericTimerInterval); + this.groupBoxTimer.Controls.Add(this.label4); + this.groupBoxTimer.Controls.Add(this.buttonToggleTimer); + this.groupBoxTimer.Location = new System.Drawing.Point(12, 147); + this.groupBoxTimer.Name = "groupBoxTimer"; + this.groupBoxTimer.Size = new System.Drawing.Size(200, 100); + this.groupBoxTimer.TabIndex = 7; + this.groupBoxTimer.TabStop = false; + this.groupBoxTimer.Text = "Timer"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(7, 20); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(67, 13); + this.label4.TabIndex = 4; + this.label4.Text = "Interval (ms):"; + // + // numericTimerInterval + // + this.numericTimerInterval.Location = new System.Drawing.Point(74, 18); + this.numericTimerInterval.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericTimerInterval.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericTimerInterval.Name = "numericTimerInterval"; + this.numericTimerInterval.Size = new System.Drawing.Size(120, 20); + this.numericTimerInterval.TabIndex = 8; + this.numericTimerInterval.Value = new decimal(new int[] { + 250, + 0, + 0, + 0}); + // + // checkBoxRandomEq + // + this.checkBoxRandomEq.AutoSize = true; + this.checkBoxRandomEq.Location = new System.Drawing.Point(10, 46); + this.checkBoxRandomEq.Name = "checkBoxRandomEq"; + this.checkBoxRandomEq.Size = new System.Drawing.Size(84, 17); + this.checkBoxRandomEq.TabIndex = 9; + this.checkBoxRandomEq.Text = "Random EQ"; + this.checkBoxRandomEq.UseVisualStyleBackColor = true; + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(741, 454); + this.Controls.Add(this.groupBoxTimer); + this.Controls.Add(this.groupBoxLcd); + this.Controls.Add(this.groupBoxVfd); + this.Controls.Add(this.labelStatus); + this.Controls.Add(this.buttonUninit); + this.Controls.Add(this.buttonInit); + this.Name = "MainForm"; + this.Text = "iMON Display Wrapper test"; + this.groupBoxVfd.ResumeLayout(false); + this.groupBoxVfd.PerformLayout(); + this.groupBoxLcd.ResumeLayout(false); + this.groupBoxLcd.PerformLayout(); + this.groupBoxTimer.ResumeLayout(false); + this.groupBoxTimer.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericTimerInterval)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonInit; + private System.Windows.Forms.Button buttonUninit; + private System.Windows.Forms.Label labelStatus; + private System.Windows.Forms.TextBox textBoxVfdTop; + private System.Windows.Forms.TextBox textBoxVfdBottom; + private System.Windows.Forms.GroupBox groupBoxVfd; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button buttonSetVfdText; + private System.Windows.Forms.GroupBox groupBoxLcd; + private System.Windows.Forms.TextBox textBoxLcd; + private System.Windows.Forms.Button buttonSetLcdText; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button buttonToggleTimer; + private System.Windows.Forms.GroupBox groupBoxTimer; + private System.Windows.Forms.NumericUpDown numericTimerInterval; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.CheckBox checkBoxRandomEq; + } +} + diff -r d5f6b2119a13 -r 328515997e35 IdwTest/MainForm.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/MainForm.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Timers; +using System.Runtime.InteropServices; + +namespace IdwTest +{ + public partial class MainForm : Form + { + iMON.Display iDisplay; + System.Timers.Timer iTimer; + int iFrameCount = 0; + + iMON.Display.DSPEQDATA iEqLeft; + iMON.Display.DSPEQDATA iEqRight; + iMON.Display.DSPEQDATA iEqMono; + + Random iRandom; + + public MainForm() + { + iDisplay = new iMON.Display(); + InitializeComponent(); + iTimer = new System.Timers.Timer(500); // Set up the timer for N ms + iTimer.Elapsed += new ElapsedEventHandler(timer_Elapsed); + iTimer.Enabled = false; // Enable it + // + iEqLeft =new iMON.Display.DSPEQDATA(); + iEqRight = new iMON.Display.DSPEQDATA(); + iEqMono = new iMON.Display.DSPEQDATA(); + // + iRandom = new Random(); + } + + private void buttonInit_Click(object sender, EventArgs e) + { + if (!iDisplay.DoInit()) + { + labelStatus.Text = iDisplay.StatusMessage; + } + else + { + labelStatus.Text = iDisplay.Name(); + } + } + + private void buttonUninit_Click(object sender, EventArgs e) + { + iDisplay.DoUninit(); + } + + private void buttonSetLcdText_Click(object sender, EventArgs e) + { + iMON.Display.IDW_SetLcdText(textBoxLcd.Text); + } + + private void timer_Elapsed(object sender, ElapsedEventArgs e) + { + if (iDisplay.IsLcd()) + { + if (!checkBoxRandomEq.Checked) + { + iMON.Display.IDW_SetLcdText(iFrameCount.ToString()); + iFrameCount++; + } + else + { + for (int i = 0; i < 16; i++) + { + iEqLeft.BandData[i] = iRandom.Next(0,101); + iEqRight.BandData[i] = iRandom.Next(0, 101); + } + + iMON.Display.IDW_SetLcdEqData(iEqLeft, iEqRight); + iFrameCount++; + } + } + } + + private void buttonToggleTimer_Click(object sender, EventArgs e) + { + if (iTimer.Enabled) + { + //Stop our timer + iTimer.Enabled = false; + buttonToggleTimer.Text = "Start"; + } + else + { + iFrameCount = 0; + //Start our timer + iTimer.Interval = (double)numericTimerInterval.Value; + iTimer.Enabled = true; + buttonToggleTimer.Text = "Stop"; + } + } + + } +} diff -r d5f6b2119a13 -r 328515997e35 IdwTest/MainForm.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/MainForm.resx Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Program.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Program.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace IdwTest +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } + +} diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Properties/AssemblyInfo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Properties/AssemblyInfo.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("IdwTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("IdwTest")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6f39d385-7aa6-4675-af66-10a9cb0768d8")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Properties/Resources.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Properties/Resources.Designer.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace IdwTest.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IdwTest.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Properties/Resources.resx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Properties/Resources.resx Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Properties/Settings.Designer.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Properties/Settings.Designer.cs Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18444 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace IdwTest.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff -r d5f6b2119a13 -r 328515997e35 IdwTest/Properties/Settings.settings --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/IdwTest/Properties/Settings.settings Mon Apr 21 12:02:38 2014 +0200 @@ -0,0 +1,7 @@ + + + + + + +