From: <an...@us...> - 2008-04-25 13:08:50
|
Revision: 1712 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1712&view=rev Author: and-81 Date: 2008-04-25 06:08:25 -0700 (Fri, 25 Apr 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/IRMan Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Imon USB Receivers/Imon USB Receivers.cs trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml trunk/plugins/IR Server Suite/setup/setup.nsi Added Paths: ----------- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.cs trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.resx trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Icon.ico trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.Designer.cs trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.resx trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Pinnacle Serial/ Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -488,7 +488,6 @@ { throw new InvalidOperationException("An error occurred while retrieving the list of devices"); } - } static string GetFriendlyName(string vidAndPid) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IR507 Receiver/IR507Receiver.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -314,7 +314,6 @@ { Marshal.FreeHGlobal(buffer); } - } static string FindDevice(Guid classGuid) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/IRMan Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/IRMan Receiver.cs 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IRMan Receiver/IRMan Receiver.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -134,7 +134,7 @@ try { - _serialPort.Dispose(); + _serialPort.Close(); } #if TRACE catch (Exception ex) Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Imon USB Receivers/Imon USB Receivers.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Imon USB Receivers/Imon USB Receivers.cs 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Imon USB Receivers/Imon USB Receivers.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -921,12 +921,15 @@ IntPtr deviceBufferPtr = IntPtr.Zero; - try + switch (mode) { - switch (mode) + + #region iMon + case RcMode.iMon: { - case RcMode.iMon: - foreach (byte[] send in SetModeiMon) + foreach (byte[] send in SetModeiMon) + { + try { deviceBufferPtr = Marshal.AllocHGlobal(send.Length); @@ -934,11 +937,33 @@ IoControl(IOCTL_IMON_WRITE, deviceBufferPtr, send.Length, IntPtr.Zero, 0, out bytesRead); Marshal.FreeHGlobal(deviceBufferPtr); + deviceBufferPtr = IntPtr.Zero; } - break; +#if DEBUG + catch (Exception ex) + { + DebugWriteLine(ex.ToString()); +#else + catch + { +#endif + if (_deviceHandle != null) + CancelIo(_deviceHandle); - case RcMode.Mce: - foreach (byte[] send in SetModeMCE) + if (deviceBufferPtr != IntPtr.Zero) + Marshal.FreeHGlobal(deviceBufferPtr); + } + } + break; + } + #endregion iMon + + #region Mce + case RcMode.Mce: + { + foreach (byte[] send in SetModeMCE) + { + try { deviceBufferPtr = Marshal.AllocHGlobal(send.Length); @@ -946,26 +971,28 @@ IoControl(IOCTL_IMON_WRITE, deviceBufferPtr, send.Length, IntPtr.Zero, 0, out bytesRead); Marshal.FreeHGlobal(deviceBufferPtr); + deviceBufferPtr = IntPtr.Zero; } - break; - } - } #if DEBUG - catch (Exception ex) - { - DebugWriteLine(ex.ToString()); + catch (Exception ex) + { + DebugWriteLine(ex.ToString()); #else - catch - { + catch + { #endif - if (_deviceHandle != null) - CancelIo(_deviceHandle); + if (_deviceHandle != null) + CancelIo(_deviceHandle); + + if (deviceBufferPtr != IntPtr.Zero) + Marshal.FreeHGlobal(deviceBufferPtr); + } + } + break; + } + #endregion Mce + } - finally - { - if (deviceBufferPtr != IntPtr.Zero) - Marshal.FreeHGlobal(deviceBufferPtr); - } } #endregion DosDevice Specific Helper Functions Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.Designer.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,159 @@ +namespace InputService.Plugin +{ + partial class Configure + { + /// <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.components = new System.ComponentModel.Container(); + this.labelButtonRepeatDelay = new System.Windows.Forms.Label(); + this.numericUpDownButtonRepeatDelay = new System.Windows.Forms.NumericUpDown(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.toolTips = new System.Windows.Forms.ToolTip(this.components); + this.labelPort = new System.Windows.Forms.Label(); + this.comboBoxPort = new System.Windows.Forms.ComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).BeginInit(); + this.SuspendLayout(); + // + // labelButtonRepeatDelay + // + this.labelButtonRepeatDelay.Location = new System.Drawing.Point(8, 8); + this.labelButtonRepeatDelay.Name = "labelButtonRepeatDelay"; + this.labelButtonRepeatDelay.Size = new System.Drawing.Size(120, 20); + this.labelButtonRepeatDelay.TabIndex = 0; + this.labelButtonRepeatDelay.Text = "Button repeat delay:"; + this.labelButtonRepeatDelay.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // numericUpDownButtonRepeatDelay + // + this.numericUpDownButtonRepeatDelay.Increment = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDownButtonRepeatDelay.Location = new System.Drawing.Point(128, 8); + this.numericUpDownButtonRepeatDelay.Maximum = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + this.numericUpDownButtonRepeatDelay.Minimum = new decimal(new int[] { + 50, + 0, + 0, + 0}); + this.numericUpDownButtonRepeatDelay.Name = "numericUpDownButtonRepeatDelay"; + this.numericUpDownButtonRepeatDelay.Size = new System.Drawing.Size(88, 20); + this.numericUpDownButtonRepeatDelay.TabIndex = 1; + this.numericUpDownButtonRepeatDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.numericUpDownButtonRepeatDelay.ThousandsSeparator = true; + this.toolTips.SetToolTip(this.numericUpDownButtonRepeatDelay, "How long between repeated buttons (in milliseconds)"); + this.numericUpDownButtonRepeatDelay.Value = new decimal(new int[] { + 10000, + 0, + 0, + 0}); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(82, 74); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(64, 24); + this.buttonOK.TabIndex = 4; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(154, 74); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(64, 24); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // labelPort + // + this.labelPort.Location = new System.Drawing.Point(8, 40); + this.labelPort.Name = "labelPort"; + this.labelPort.Size = new System.Drawing.Size(120, 21); + this.labelPort.TabIndex = 2; + this.labelPort.Text = "Serial port:"; + this.labelPort.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // comboBoxPort + // + this.comboBoxPort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxPort.FormattingEnabled = true; + this.comboBoxPort.Location = new System.Drawing.Point(128, 40); + this.comboBoxPort.Name = "comboBoxPort"; + this.comboBoxPort.Size = new System.Drawing.Size(88, 21); + this.comboBoxPort.TabIndex = 3; + // + // Configure + // + this.AcceptButton = this.buttonOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.buttonCancel; + this.ClientSize = new System.Drawing.Size(224, 104); + this.Controls.Add(this.labelButtonRepeatDelay); + this.Controls.Add(this.comboBoxPort); + this.Controls.Add(this.numericUpDownButtonRepeatDelay); + this.Controls.Add(this.labelPort); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(232, 138); + this.Name = "Configure"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "IRMan Receiver Configuration"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonRepeatDelay)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label labelButtonRepeatDelay; + private System.Windows.Forms.NumericUpDown numericUpDownButtonRepeatDelay; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.ToolTip toolTips; + private System.Windows.Forms.Label labelPort; + private System.Windows.Forms.ComboBox comboBoxPort; + } +} \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.IO.Ports; +using System.Text; +using System.Windows.Forms; + +namespace InputService.Plugin +{ + + partial class Configure : Form + { + + #region Variables + + string[] _ports; + + #endregion Variables + + #region Properties + + public int RepeatDelay + { + get { return Decimal.ToInt32(numericUpDownButtonRepeatDelay.Value); } + set { numericUpDownButtonRepeatDelay.Value = new Decimal(value); } + } + public string CommPort + { + get { return comboBoxPort.SelectedItem as string; } + set { comboBoxPort.SelectedItem = value; } + } + + #endregion Properties + + #region Constructor + + public Configure() + { + InitializeComponent(); + + comboBoxPort.Items.Clear(); + + _ports = SerialPort.GetPortNames(); + if (_ports == null || _ports.Length == 0) + { + MessageBox.Show(this, "No available serial ports found!", "IRMan Receiver", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + comboBoxPort.Items.AddRange(_ports); + } + + #endregion Constructor + + #region Buttons + + private void buttonOK_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + #endregion Buttons + + } + +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.resx =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.resx (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Configure.resx 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,123 @@ +<?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> + <metadata name="toolTips.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Icon.ico =================================================================== (Binary files differ) Property changes on: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Icon.ico ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,304 @@ +using System; +using System.Collections.Generic; +#if TRACE +using System.Diagnostics; +#endif +using System.Drawing; +using System.IO; +using System.IO.Ports; +using System.Text; +using System.Threading; +using System.Windows.Forms; +using System.Xml; + +namespace InputService.Plugin +{ + + /// <summary> + /// IR Server Plugin for Pinnacle Serial Receiver device. + /// </summary> + public class PinnacleSerialReceiver : PluginBase, IConfigure, IRemoteReceiver + { + + #region Constants + + static readonly string ConfigurationFile = Path.Combine(ConfigurationPath, "Pinnacle Serial Receiver.xml"); + + const int DeviceBufferSize = 3; + + #endregion Constants + + #region Variables + + SerialPort _serialPort; + byte[] _deviceBuffer; + + RemoteHandler _remoteButtonHandler; + + int _repeatDelay; + string _serialPortName; + + bool _disposed; + + string _lastCode = String.Empty; + DateTime _lastCodeTime = DateTime.Now; + + #endregion Variables + + #region Implementation + + /// <summary> + /// Name of the IR Server plugin. + /// </summary> + /// <value>The name.</value> + public override string Name { get { return "Pinnacle Serial"; } } + /// <summary> + /// IR Server plugin version. + /// </summary> + /// <value>The version.</value> + public override string Version { get { return "1.4.2.0"; } } + /// <summary> + /// The IR Server plugin's author. + /// </summary> + /// <value>The author.</value> + public override string Author { get { return "and-81"; } } + /// <summary> + /// A description of the IR Server plugin. + /// </summary> + /// <value>The description.</value> + public override string Description { get { return "Receiver support for the Pinnacle Serial device"; } } + /// <summary> + /// Gets the plugin icon. + /// </summary> + /// <value>The plugin icon.</value> + public override Icon DeviceIcon { get { return Properties.Resources.Icon; } } + + /// <summary> + /// Start the IR Server plugin. + /// </summary> + public override void Start() + { + LoadSettings(); + + _deviceBuffer = new byte[DeviceBufferSize]; + + _serialPort = new SerialPort(_serialPortName, 1200, Parity.None, 8, StopBits.One); + _serialPort.Handshake = Handshake.None; + _serialPort.DtrEnable = false; + _serialPort.RtsEnable = true; + _serialPort.ReadBufferSize = DeviceBufferSize; + _serialPort.ReadTimeout = 1000; + + _serialPort.Open(); + Thread.Sleep(100); + _serialPort.DiscardInBuffer(); + + _serialPort.ReceivedBytesThreshold = DeviceBufferSize; + _serialPort.DataReceived += new SerialDataReceivedEventHandler(SerialPort_DataReceived); + } + /// <summary> + /// Suspend the IR Server plugin when computer enters standby. + /// </summary> + public override void Suspend() + { + Stop(); + } + /// <summary> + /// Resume the IR Server plugin when the computer returns from standby. + /// </summary> + public override void Resume() + { + Start(); + } + /// <summary> + /// Stop the IR Server plugin. + /// </summary> + public override void Stop() + { + if (_serialPort == null) + return; + + try + { + _serialPort.Close(); + } +#if TRACE + catch (Exception ex) + { + Trace.WriteLine(ex.ToString()); + } +#else + catch + { + } +#endif + finally + { + _serialPort = null; + } + } + + /// <summary> + /// Callback for remote button presses. + /// </summary> + /// <value>The remote callback.</value> + public RemoteHandler RemoteCallback + { + get { return _remoteButtonHandler; } + set { _remoteButtonHandler = value; } + } + + /// <summary> + /// Configure the IR Server plugin. + /// </summary> + public void Configure(IWin32Window owner) + { + LoadSettings(); + + Configure config = new Configure(); + + config.RepeatDelay = _repeatDelay; + config.CommPort = _serialPortName; + + if (config.ShowDialog(owner) == DialogResult.OK) + { + _repeatDelay = config.RepeatDelay; + _serialPortName = config.CommPort; + + SaveSettings(); + } + } + + /// <summary> + /// Handles the DataReceived event of the SerialPort control. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="System.IO.Ports.SerialDataReceivedEventArgs"/> instance containing the event data.</param> + void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) + { + try + { + _serialPort.Read(_deviceBuffer, 0, DeviceBufferSize); + + TimeSpan timeSpan = DateTime.Now - _lastCodeTime; + + StringBuilder keyCode = new StringBuilder(2 * DeviceBufferSize); + for (int index = 0; index < DeviceBufferSize; index++) + keyCode.Append(_deviceBuffer[index].ToString("X2")); + + string thisCode = keyCode.ToString(); + + if (thisCode.Equals(_lastCode, StringComparison.Ordinal)) // Repeated button + { + if (timeSpan.Milliseconds > _repeatDelay) + { + _remoteButtonHandler(this.Name, thisCode); + _lastCodeTime = DateTime.Now; + } + } + else + { + _remoteButtonHandler(this.Name, thisCode); + _lastCodeTime = DateTime.Now; + } + + _lastCode = thisCode; + } +#if TRACE + catch (Exception ex) + { + Trace.WriteLine(ex.ToString()); + } +#else + catch + { + } +#endif + } + + /// <summary> + /// Releases unmanaged and - optionally - managed resources + /// </summary> + /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> + protected virtual void Dispose(bool disposing) + { + // process only if mananged and unmanaged resources have + // not been disposed of. + if (!this._disposed) + { + if (disposing) + { + // dispose managed resources + Stop(); + } + + // dispose unmanaged resources + this._disposed = true; + } + } + + /// <summary> + /// Loads the settings. + /// </summary> + void LoadSettings() + { + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(ConfigurationFile); + + _repeatDelay = int.Parse(doc.DocumentElement.Attributes["RepeatDelay"].Value); + _serialPortName = doc.DocumentElement.Attributes["SerialPortName"].Value; + } +#if TRACE + catch (Exception ex) + { + Trace.WriteLine(ex.ToString()); +#else + catch + { +#endif + + _repeatDelay = 500; + _serialPortName = "COM1"; + } + } + /// <summary> + /// Saves the settings. + /// </summary> + void SaveSettings() + { + try + { + using (XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, Encoding.UTF8)) + { + writer.Formatting = Formatting.Indented; + writer.Indentation = 1; + writer.IndentChar = (char)9; + writer.WriteStartDocument(true); + writer.WriteStartElement("settings"); // <settings> + + writer.WriteAttributeString("RepeatDelay", _repeatDelay.ToString()); + writer.WriteAttributeString("SerialPortName", _serialPortName); + + writer.WriteEndElement(); // </settings> + writer.WriteEndDocument(); + } + } +#if TRACE + catch (Exception ex) + { + Trace.WriteLine(ex.ToString()); + } +#else + catch + { + } +#endif + } + + #endregion Implementation + + } + +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.csproj (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Pinnacle Serial Receiver.csproj 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,93 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.50727</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{EBFA0F67-1EB6-4282-8475-C397B9852B3F}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>InputService.Plugin</RootNamespace> + <AssemblyName>Pinnacle Serial Receiver</AssemblyName> + <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> + <ApplicationIcon>Icon.ico</ApplicationIcon> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>false</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + <DocumentationFile>bin\Debug\Pinnacle Serial Receiver.XML</DocumentationFile> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants> + </DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Configure.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Configure.Designer.cs"> + <DependentUpon>Configure.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Pinnacle Serial Receiver.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Configure.resx"> + <DependentUpon>Configure.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="Properties\Resources.resx"> + <SubType>Designer</SubType> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\IR Server Plugin Interface\IR Server Plugin Interface.csproj"> + <Project>{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}</Project> + <Name>IR Server Plugin Interface</Name> + <Private>False</Private> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="Icon.ico" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent> + </PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/AssemblyInfo.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,36 @@ +using System; +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("Pinnacle Serial Receiver")] +[assembly: AssemblyDescription("IR Server plugin to support the Pinnacle Serial receiver")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("and-81")] +[assembly: AssemblyProduct("PinnacleSerialReceiver")] +[assembly: AssemblyCopyright("Aaron Dinnage")] +[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)] + +// 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 Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.4.2.0")] +[assembly: AssemblyFileVersion("1.4.2.0")] + +[assembly: CLSCompliant(true)] +[assembly: Guid("FE926576-8701-477f-9694-73895D480F5F")] Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.Designer.cs (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.Designer.cs 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.832 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace InputService.Plugin.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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", "2.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() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InputService.Plugin.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static System.Drawing.Icon Icon { + get { + object obj = ResourceManager.GetObject("Icon", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + } +} Added: trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.resx =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.resx (rev 0) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Pinnacle Serial Receiver/Properties/Resources.resx 2008-04-25 13:08:25 UTC (rev 1712) @@ -0,0 +1,124 @@ +<?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> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\icon.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> +</root> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/iMon/Imon PAD.xml 2008-04-25 13:08:25 UTC (rev 1712) @@ -39,6 +39,5 @@ <RemoteTable RawCode="1040" AbstractButton="TV" /> <RemoteTable RawCode="1106" AbstractButton="AspectRatio" /> <RemoteTable RawCode="1114" AbstractButton="Eject" /> - <RemoteTable RawCode="1002" AbstractButton="Close" /> <RemoteTable RawCode="1166" AbstractButton="Fullscreen" /> </DocumentElement> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/setup/setup.nsi =================================================================== --- trunk/plugins/IR Server Suite/setup/setup.nsi 2008-04-25 05:54:50 UTC (rev 1711) +++ trunk/plugins/IR Server Suite/setup/setup.nsi 2008-04-25 13:08:25 UTC (rev 1712) @@ -352,6 +352,7 @@ File "..\IR Server Plugins\LiveDrive Receiver\bin\${BuildType}\LiveDrive Receiver.*" File "..\IR Server Plugins\MacMini Receiver\bin\${BuildType}\MacMini Receiver.*" File "..\IR Server Plugins\Microsoft MCE Transceiver\bin\${BuildType}\Microsoft MCE Transceiver.*" + File "..\IR Server Plugins\Pinnacle Serial Receiver\bin\${BuildType}\Pinnacle Serial Receiver.*" ;File "..\IR Server Plugins\RC102 Receiver\bin\${BuildType}\RC102 Receiver.*" File "..\IR Server Plugins\RedEye Blaster\bin\${BuildType}\RedEye Blaster.*" File "..\IR Server Plugins\Serial IR Blaster\bin\${BuildType}\Serial IR Blaster.*" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |