|
From: <an...@us...> - 2007-06-06 17:03:07
|
Revision: 489
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=489&view=rev
Author: and-81
Date: 2007-06-06 09:52:56 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs
trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs
trunk/plugins/IR Server Suite/Applications/Translator/Program.cs
trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj
trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs
trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs
trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs
trunk/plugins/IR Server Suite/IR Server Suite.sln
trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs
Added Paths:
-----------
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj
trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs
Modified: trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Applications/IR Server/IRServer.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -111,10 +111,11 @@
while (_plugin == null)
{
_plugin = Program.GetPlugin(_pluginName);
- IrssLog.Warn("Failed to load plugin \"{0}\"", _pluginName);
if (_plugin == null)
{
+ IrssLog.Warn("Failed to load plugin \"{0}\"", _pluginName);
+
if (Configure())
SaveSettings();
else
@@ -282,6 +283,7 @@
return false;
}
+ // Todo: Put in the proper retry system from other apps/plugins
void StartMessageQueue()
{
_processMessageQueue = true;
Modified: trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Applications/IR Server/Program.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -37,6 +37,7 @@
// Open log file
try
{
+ // TODO: Change log level to info for release.
IrssLog.LogLevel = IrssLog.Level.Debug;
IrssLog.Open(Common.FolderIrssLogs + "IR Server.log");
@@ -138,12 +139,8 @@
return null;
foreach (IIRServerPlugin plugin in serverPlugins)
- {
- if (plugin.Name == pluginName)
- {
+ if (plugin.Name.Equals(pluginName, StringComparison.InvariantCultureIgnoreCase))
return plugin;
- }
- }
return null;
}
Modified: trunk/plugins/IR Server Suite/Applications/Translator/Program.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Applications/Translator/Program.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -153,6 +153,7 @@
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
+ // TODO: Change log level to info for release.
IrssLog.LogLevel = IrssLog.Level.Debug;
IrssLog.Open(Common.FolderIrssLogs + "Translator.log");
Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray Launcher.csproj 2007-06-06 16:52:56 UTC (rev 489)
@@ -65,7 +65,6 @@
<DependentUpon>Setup.cs</DependentUpon>
</Compile>
<Compile Include="Tray.cs">
- <SubType>Form</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
Modified: trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs
===================================================================
--- trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Applications/Tray Launcher/Tray.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -15,7 +15,7 @@
namespace TrayLauncher
{
- public class Tray : Form
+ public class Tray
{
#region Constants
@@ -491,7 +491,7 @@
setup.LaunchOnLoad = _launchOnLoad;
setup.LaunchKeyCode = _launchKeyCode;
- if (setup.ShowDialog(this) == DialogResult.OK)
+ if (setup.ShowDialog() == DialogResult.OK)
{
_autoRun = setup.AutoRun;
_serverHost = setup.ServerHost;
@@ -547,7 +547,7 @@
catch (Exception ex)
{
IrssLog.Error(ex.Message);
- MessageBox.Show(this, ex.Message, "Tray Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ex.Message, "Tray Launcher", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
void ClickQuit(object sender, EventArgs e)
Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs
===================================================================
--- trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Common/IrssUtils/CDRom.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -27,11 +27,20 @@
#region Static Methods
+ /// <summary>
+ /// Given a drive letter this function returns true if it is a CD-Rom.
+ /// </summary>
+ /// <param name="driveLetter">Drive letter to test.</param>
+ /// <returns>True if the drive is a CD-Rom, else false.</returns>
public static bool IsCDRom(string driveLetter)
{
return (GetDriveType(driveLetter) == DRIVE_CDROM);
}
+ /// <summary>
+ /// Open the tray on the given CD-Rom drive.
+ /// </summary>
+ /// <param name="driveLetter">Drive letter of CD-Rom to open.</param>
public static void Open(string driveLetter)
{
string returnString = "";
@@ -39,6 +48,10 @@
mciSendStringA(command, returnString, 0, 0);
}
+ /// <summary>
+ /// Close the tray on the given CD-Rom drive.
+ /// </summary>
+ /// <param name="driveLetter">Drive letter of CD-Rom to close.</param>
public static void Close(string driveLetter)
{
string returnString = "";
Modified: trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs
===================================================================
--- trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/Common/MPUtils/ExternalChannelConfig.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -12,7 +12,7 @@
#region Constants
- const int DefaultCardID = -1;
+ const int DefaultCardID = 0;
const int DefaultPauseTime = 250;
const bool DefaultSendSelect = false;
@@ -28,19 +28,19 @@
string _fileName;
- int _cardID = -1;
+ int _cardID;
- int _pauseTime = 250;
- bool _sendSelect = false;
- bool _doubleChannelSelect = false;
- int _repeatChannelCommands = 0;
- int _channelDigits = 0;
- int _repeatPauseTime = 1000;
- bool _usePreChangeCommand = false;
+ int _pauseTime;
+ bool _sendSelect;
+ bool _doubleChannelSelect;
+ int _repeatChannelCommands;
+ int _channelDigits;
+ int _repeatPauseTime;
+ bool _usePreChangeCommand;
- string _selectCommand = String.Empty;
- string _preChangeCommand = String.Empty;
- string[] _digits = new string[10];
+ string _selectCommand;
+ string _preChangeCommand;
+ string[] _digits;
#endregion Variables
@@ -212,7 +212,7 @@
ExternalChannelConfig newECC = new ExternalChannelConfig(fileName);
XmlDocument doc = new XmlDocument();
- doc.Load(newECC._fileName);
+ doc.Load(fileName);
newECC.PauseTime = GetInt(doc, "PauseTime", DefaultPauseTime);
newECC.UsePreChangeCommand = GetBool(doc, "UsePreChangeCommand", DefaultUsePreChangeCommand);
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.Designer.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,235 @@
+namespace WinLircReceiver
+{
+ 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.buttonOK = new System.Windows.Forms.Button();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.toolTips = new System.Windows.Forms.ToolTip(this.components);
+ this.textBoxServerAddress = new System.Windows.Forms.TextBox();
+ this.numericUpDownServerPort = new System.Windows.Forms.NumericUpDown();
+ this.checkBoxStartServer = new System.Windows.Forms.CheckBox();
+ this.textBoxServerPath = new System.Windows.Forms.TextBox();
+ this.buttonLocate = new System.Windows.Forms.Button();
+ this.numericUpDownButtonReleaseTime = new System.Windows.Forms.NumericUpDown();
+ this.labelServerAddress = new System.Windows.Forms.Label();
+ this.labelServerPort = new System.Windows.Forms.Label();
+ this.groupBoxServerDetails = new System.Windows.Forms.GroupBox();
+ this.labelButtonReleaseTime = new System.Windows.Forms.Label();
+ this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownServerPort)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonReleaseTime)).BeginInit();
+ this.groupBoxServerDetails.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // 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(104, 208);
+ this.buttonOK.Name = "buttonOK";
+ this.buttonOK.Size = new System.Drawing.Size(64, 24);
+ this.buttonOK.TabIndex = 3;
+ 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(176, 208);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(64, 24);
+ this.buttonCancel.TabIndex = 4;
+ this.buttonCancel.Text = "Cancel";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ //
+ // textBoxServerAddress
+ //
+ this.textBoxServerAddress.Location = new System.Drawing.Point(128, 24);
+ this.textBoxServerAddress.Name = "textBoxServerAddress";
+ this.textBoxServerAddress.Size = new System.Drawing.Size(96, 20);
+ this.textBoxServerAddress.TabIndex = 1;
+ this.toolTips.SetToolTip(this.textBoxServerAddress, "IP Address for WinLirc server");
+ //
+ // numericUpDownServerPort
+ //
+ this.numericUpDownServerPort.Location = new System.Drawing.Point(128, 56);
+ this.numericUpDownServerPort.Maximum = new decimal(new int[] {
+ 65535,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownServerPort.Name = "numericUpDownServerPort";
+ this.numericUpDownServerPort.Size = new System.Drawing.Size(96, 20);
+ this.numericUpDownServerPort.TabIndex = 3;
+ this.numericUpDownServerPort.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.toolTips.SetToolTip(this.numericUpDownServerPort, "TCP Port for WinLirc server");
+ //
+ // checkBoxStartServer
+ //
+ this.checkBoxStartServer.AutoSize = true;
+ this.checkBoxStartServer.Location = new System.Drawing.Point(8, 96);
+ this.checkBoxStartServer.Name = "checkBoxStartServer";
+ this.checkBoxStartServer.Size = new System.Drawing.Size(119, 17);
+ this.checkBoxStartServer.TabIndex = 4;
+ this.checkBoxStartServer.Text = "Start WinLirc server";
+ this.toolTips.SetToolTip(this.checkBoxStartServer, "Start the WinLirc server application?");
+ this.checkBoxStartServer.UseVisualStyleBackColor = true;
+ //
+ // textBoxServerPath
+ //
+ this.textBoxServerPath.Location = new System.Drawing.Point(8, 120);
+ this.textBoxServerPath.Name = "textBoxServerPath";
+ this.textBoxServerPath.Size = new System.Drawing.Size(184, 20);
+ this.textBoxServerPath.TabIndex = 5;
+ this.toolTips.SetToolTip(this.textBoxServerPath, "Path to WinLirc server application");
+ //
+ // buttonLocate
+ //
+ this.buttonLocate.AutoEllipsis = true;
+ this.buttonLocate.Location = new System.Drawing.Point(200, 120);
+ this.buttonLocate.Name = "buttonLocate";
+ this.buttonLocate.Size = new System.Drawing.Size(24, 20);
+ this.buttonLocate.TabIndex = 6;
+ this.buttonLocate.Text = "...";
+ this.toolTips.SetToolTip(this.buttonLocate, "Locate WinLirc server application");
+ this.buttonLocate.UseVisualStyleBackColor = true;
+ this.buttonLocate.Click += new System.EventHandler(this.buttonLocate_Click);
+ //
+ // numericUpDownButtonReleaseTime
+ //
+ this.numericUpDownButtonReleaseTime.Location = new System.Drawing.Point(144, 176);
+ this.numericUpDownButtonReleaseTime.Maximum = new decimal(new int[] {
+ 65535,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownButtonReleaseTime.Name = "numericUpDownButtonReleaseTime";
+ this.numericUpDownButtonReleaseTime.Size = new System.Drawing.Size(96, 20);
+ this.numericUpDownButtonReleaseTime.TabIndex = 2;
+ this.numericUpDownButtonReleaseTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+ this.toolTips.SetToolTip(this.numericUpDownButtonReleaseTime, "Button release time");
+ //
+ // labelServerAddress
+ //
+ this.labelServerAddress.Location = new System.Drawing.Point(8, 24);
+ this.labelServerAddress.Name = "labelServerAddress";
+ this.labelServerAddress.Size = new System.Drawing.Size(112, 20);
+ this.labelServerAddress.TabIndex = 0;
+ this.labelServerAddress.Text = "Server address:";
+ this.labelServerAddress.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // labelServerPort
+ //
+ this.labelServerPort.Location = new System.Drawing.Point(8, 56);
+ this.labelServerPort.Name = "labelServerPort";
+ this.labelServerPort.Size = new System.Drawing.Size(112, 20);
+ this.labelServerPort.TabIndex = 2;
+ this.labelServerPort.Text = "Server port:";
+ this.labelServerPort.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // groupBoxServerDetails
+ //
+ this.groupBoxServerDetails.Controls.Add(this.buttonLocate);
+ this.groupBoxServerDetails.Controls.Add(this.textBoxServerPath);
+ this.groupBoxServerDetails.Controls.Add(this.checkBoxStartServer);
+ this.groupBoxServerDetails.Controls.Add(this.numericUpDownServerPort);
+ this.groupBoxServerDetails.Controls.Add(this.labelServerAddress);
+ this.groupBoxServerDetails.Controls.Add(this.labelServerPort);
+ this.groupBoxServerDetails.Controls.Add(this.textBoxServerAddress);
+ this.groupBoxServerDetails.Location = new System.Drawing.Point(8, 8);
+ this.groupBoxServerDetails.Name = "groupBoxServerDetails";
+ this.groupBoxServerDetails.Size = new System.Drawing.Size(232, 152);
+ this.groupBoxServerDetails.TabIndex = 0;
+ this.groupBoxServerDetails.TabStop = false;
+ this.groupBoxServerDetails.Text = "WinLirc Server";
+ //
+ // labelButtonReleaseTime
+ //
+ this.labelButtonReleaseTime.Location = new System.Drawing.Point(8, 176);
+ this.labelButtonReleaseTime.Name = "labelButtonReleaseTime";
+ this.labelButtonReleaseTime.Size = new System.Drawing.Size(112, 20);
+ this.labelButtonReleaseTime.TabIndex = 1;
+ this.labelButtonReleaseTime.Text = "Button release time:";
+ this.labelButtonReleaseTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // openFileDialog
+ //
+ this.openFileDialog.FileName = "openFileDialog";
+ this.openFileDialog.Filter = "All Files|*.*";
+ this.openFileDialog.Title = "Locate WinLirc server application";
+ //
+ // 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(248, 241);
+ this.Controls.Add(this.numericUpDownButtonReleaseTime);
+ this.Controls.Add(this.labelButtonReleaseTime);
+ this.Controls.Add(this.groupBoxServerDetails);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.buttonOK);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.MinimumSize = new System.Drawing.Size(256, 275);
+ this.Name = "Configure";
+ this.ShowIcon = false;
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "WinLirc Configuration";
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownServerPort)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownButtonReleaseTime)).EndInit();
+ this.groupBoxServerDetails.ResumeLayout(false);
+ this.groupBoxServerDetails.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button buttonOK;
+ private System.Windows.Forms.Button buttonCancel;
+ private System.Windows.Forms.ToolTip toolTips;
+ private System.Windows.Forms.Label labelServerAddress;
+ private System.Windows.Forms.TextBox textBoxServerAddress;
+ private System.Windows.Forms.Label labelServerPort;
+ private System.Windows.Forms.NumericUpDown numericUpDownServerPort;
+ private System.Windows.Forms.GroupBox groupBoxServerDetails;
+ private System.Windows.Forms.TextBox textBoxServerPath;
+ private System.Windows.Forms.CheckBox checkBoxStartServer;
+ private System.Windows.Forms.Button buttonLocate;
+ private System.Windows.Forms.Label labelButtonReleaseTime;
+ private System.Windows.Forms.NumericUpDown numericUpDownButtonReleaseTime;
+ private System.Windows.Forms.OpenFileDialog openFileDialog;
+ }
+}
\ No newline at end of file
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Net;
+using System.Windows.Forms;
+
+namespace WinLircReceiver
+{
+
+ public partial class Configure : Form
+ {
+
+ #region Properties
+
+ public IPAddress ServerIP
+ {
+ get { return IPAddress.Parse(textBoxServerAddress.Text); }
+ set { textBoxServerAddress.Text = value.ToString(); }
+ }
+ public int ServerPort
+ {
+ get { return Decimal.ToInt32(numericUpDownServerPort.Value); }
+ set { numericUpDownServerPort.Value = new Decimal(value); }
+ }
+ public bool StartServer
+ {
+ get { return checkBoxStartServer.Checked; }
+ set { checkBoxStartServer.Checked = value; }
+ }
+ public string ServerPath
+ {
+ get { return textBoxServerPath.Text; }
+ set { textBoxServerPath.Text = value; }
+ }
+ public int ButtonReleaseTime
+ {
+ get { return Decimal.ToInt32(numericUpDownButtonReleaseTime.Value); }
+ set { numericUpDownButtonReleaseTime.Value = new Decimal(value); }
+ }
+
+ #endregion Properties
+
+ #region Constructor
+
+ public Configure()
+ {
+ InitializeComponent();
+ }
+
+ #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();
+ }
+
+ private void buttonLocate_Click(object sender, EventArgs e)
+ {
+ if (openFileDialog.ShowDialog(this) == DialogResult.OK)
+ textBoxServerPath.Text = openFileDialog.FileName;
+ }
+
+ #endregion Buttons
+
+
+ }
+
+}
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Configure.resx 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,126 @@
+<?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>
+ <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>107, 17</value>
+ </metadata>
+</root>
\ No newline at end of file
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/Properties/AssemblyInfo.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,35 @@
+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("WinLirc Receiver")]
+[assembly: AssemblyDescription("IR Server plugin to support WinLirc")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("and-81")]
+[assembly: AssemblyProduct("WinLircReceiver")]
+[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.0.3.1")]
+[assembly: AssemblyFileVersion("1.0.3.1")]
+
+[assembly: CLSCompliant(true)]
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,183 @@
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Windows.Forms;
+using System.Xml;
+
+using IRServerPluginInterface;
+
+namespace WinLircReceiver
+{
+
+ public class WinLircReceiver : IIRServerPlugin
+ {
+
+ #region Constants
+
+ static readonly string ConfigurationFile =
+ Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
+ "\\IR Server Suite\\IR Server\\WinLirc Receiver.xml";
+
+ static readonly string[] Ports = new string[] { "None" };
+ static readonly string[] Speeds = new string[] { "None" };
+
+ #endregion Constants
+
+ #region Variables
+
+ RemoteButtonHandler _remoteButtonHandler = null;
+ WinLircServer _server;
+
+ IPAddress _serverIP;
+ int _serverPort;
+ bool _startServer;
+ string _serverPath;
+ int _buttonReleaseTime;
+
+ #endregion Variables
+
+ #region IIRServerPlugin Members
+
+ public string Name { get { return "WinLirc"; } }
+ public string Version { get { return "1.0.3.1"; } }
+ public string Author { get { return "and-81, original code for MediaPortal by Sven"; } }
+ public string Description { get { return "Supports WinLirc as a reciever"; } }
+ public bool CanReceive { get { return true; } }
+ public bool CanTransmit { get { return false; } }
+ public bool CanLearn { get { return false; } }
+ public bool CanConfigure { get { return true; } }
+
+ public RemoteButtonHandler RemoteButtonCallback
+ {
+ get { return _remoteButtonHandler; }
+ set { _remoteButtonHandler = value; }
+ }
+
+ public string[] AvailablePorts { get { return Ports; } }
+ public string[] AvailableSpeeds { get { return Speeds; } }
+
+ public void Configure()
+ {
+ LoadSettings();
+
+ Configure config = new Configure();
+
+ config.ServerIP = _serverIP;
+ config.ServerPort = _serverPort;
+ config.StartServer = _startServer;
+ config.ServerPath = _serverPath;
+ config.ButtonReleaseTime = _buttonReleaseTime;
+
+ if (config.ShowDialog() == DialogResult.OK)
+ {
+ _serverIP = config.ServerIP;
+ _serverPort = config.ServerPort;
+ _startServer = config.StartServer;
+ _serverPath = config.ServerPath;
+ _buttonReleaseTime = config.ButtonReleaseTime;
+
+ SaveSettings();
+ }
+ }
+ public bool Start()
+ {
+ LoadSettings();
+
+ if (_startServer)
+ {
+ if (!WinLircServer.StartServer(_serverPath))
+ return false;
+ }
+
+ _server = new WinLircServer(_serverIP, _serverPort, TimeSpan.FromMilliseconds(_buttonReleaseTime));
+ _server.CommandEvent += new WinLircServer.CommandEventHandler(CommandHandler);
+
+ return true;
+ }
+ public void Suspend() { }
+ public void Resume() { }
+ public void Stop()
+ {
+ _server.CommandEvent -= new WinLircServer.CommandEventHandler(CommandHandler);
+ }
+
+ public bool Transmit(string file) { return false; }
+ public LearnStatus Learn(string file) { return LearnStatus.Failure; }
+
+ public bool SetPort(string port) { return true; }
+ public bool SetSpeed(string speed) { return true; }
+
+ #endregion IIRServerPlugin Members
+
+ #region Implementation
+
+ void LoadSettings()
+ {
+ try
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load(ConfigurationFile);
+
+ _serverIP = IPAddress.Parse(doc.DocumentElement.Attributes["ServerIP"].Value);
+ _serverPort = int.Parse(doc.DocumentElement.Attributes["ServerPort"].Value);
+ _startServer = bool.Parse(doc.DocumentElement.Attributes["StartServer"].Value);
+ _serverPath = doc.DocumentElement.Attributes["ServerPath"].Value;
+ _buttonReleaseTime = int.Parse(doc.DocumentElement.Attributes["ButtonReleaseTime"].Value);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+
+ _serverIP = IPAddress.Parse("127.0.0.1");
+ _serverPort = 8765;
+ _startServer = false;
+ _serverPath = "winlirc.exe";
+ _buttonReleaseTime = 200;
+ }
+ }
+ void SaveSettings()
+ {
+ try
+ {
+ XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, System.Text.Encoding.UTF8);
+ writer.Formatting = Formatting.Indented;
+ writer.Indentation = 1;
+ writer.IndentChar = (char)9;
+ writer.WriteStartDocument(true);
+ writer.WriteStartElement("settings"); // <settings>
+
+ writer.WriteAttributeString("ServerIP", _serverIP.ToString());
+ writer.WriteAttributeString("ServerPort", _serverPort.ToString());
+ writer.WriteAttributeString("StartServer", _startServer.ToString());
+ writer.WriteAttributeString("ServerPath", _serverPath);
+ writer.WriteAttributeString("ButtonReleaseTime", _buttonReleaseTime.ToString());
+
+ writer.WriteEndElement(); // </settings>
+ writer.WriteEndDocument();
+ writer.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ }
+
+ void CommandHandler(WinLircServer.Command cmd)
+ {
+ if (_remoteButtonHandler == null)
+ return;
+
+ string buttonCode = cmd.Remote + ": " + cmd.Button;
+
+ _remoteButtonHandler(buttonCode);
+ }
+
+ #endregion Implementation
+
+ }
+
+}
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLirc Receiver.csproj 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,78 @@
+<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>{E6A68244-8C31-44A9-9F85-B4A102B5F209}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>WinLircReceiver</RootNamespace>
+ <AssemblyName>WinLirc Receiver</AssemblyName>
+ <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
+ </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>
+ </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="WinLirc Receiver.cs" />
+ <Compile Include="WinLircServer.cs" />
+ </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>
+ <EmbeddedResource Include="Configure.resx">
+ <DependentUpon>Configure.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </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>copy "$(TargetFileName)" "\MediaPortal Development\Plugin Releases\IR Server Suite\IR Server Plugins\"</PostBuildEvent>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
Added: trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs (rev 0)
+++ trunk/plugins/IR Server Suite/IR Server Plugins/WinLirc Receiver/WinLircServer.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -0,0 +1,226 @@
+#region Copyright (C) 2005-2007 Team MediaPortal
+
+/*
+ * Copyright (C) 2005-2007 Team MediaPortal
+ * http://www.team-mediaportal.com
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Diagnostics;
+
+namespace WinLircReceiver
+{
+ /// <summary>
+ /// WinLIRC server class implementing communication with WinLIRC
+ /// all remotes are supported as long as WinLIRC supports them
+ /// </summary>
+ public class WinLircServer
+ {
+ #region Variables
+
+ public delegate void CommandEventHandler(Command cmd);
+ public event CommandEventHandler CommandEvent;
+ Socket _socket; // Socket for WinLIRC communication
+ TimeSpan _buttonReleaseTime; // Time span in which multiple receptions of the same command are ignored
+ AsyncCallback _dataCallback; // Callback function receiving data from WinLIRC
+ IAsyncResult _dataCallbackResult; // Result of the callback function
+ Command _lastCommand; // Last command actually sent to InputHandler
+
+ #endregion
+
+ #region Constructors + Initialization
+
+ public WinLircServer(IPAddress ip, int port, TimeSpan buttonReleaseTime)
+ {
+ _buttonReleaseTime = buttonReleaseTime;
+ _lastCommand = new Command();
+
+ _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ _socket.Connect(ip, port); // Connect; error handling is done in SetupDataCallback()
+
+ SetupDataCallback(); // Setup callback function that will receive data
+ }
+
+ /// <summary>
+ /// Set up callback function receiving data from WinLIRC
+ /// </summary>
+ private void SetupDataCallback()
+ {
+ try
+ {
+ if (_dataCallback == null)
+ _dataCallback = new AsyncCallback(OnDataReceived);
+
+ SocketInfo info = new SocketInfo();
+ info._socket = _socket;
+ _dataCallbackResult = _socket.BeginReceive(info._dataBuffer, 0, info._dataBuffer.Length, SocketFlags.None, _dataCallback, info);
+ }
+ catch (SocketException se)
+ {
+ Console.WriteLine("WLirc: Error listening to socket: " + se.Message);
+ }
+
+ }
+ #endregion
+
+ #region Public Methods
+
+ public static bool StartServer(String path)
+ {
+ if (IsServerRunning())
+ Console.WriteLine("WLirc: WinLIRC server was not started (already running)");
+ else
+ {
+ Console.WriteLine("WLirc: Starting WinLIRC server...");
+ try
+ {
+ Process.Start(path);
+ }
+ catch (Exception)
+ {
+ Console.WriteLine("WLirc: WinLIRC server start failed");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static bool IsServerRunning()
+ {
+ Process[] processes = Process.GetProcessesByName("winlirc");
+ return (processes.Length > 0);
+ }
+
+ #endregion
+
+ #region Private Methods
+ /// <summary>
+ /// Callback function receiving data from WinLIRC
+ /// </summary>
+ private void OnDataReceived(IAsyncResult async)
+ {
+ try
+ {
+ SocketInfo info = (SocketInfo)async.AsyncState;
+ int receivedBytesCount = info._socket.EndReceive(async);
+
+ // Convert received bytes to string
+ char[] chars = new char[receivedBytesCount + 1];
+ System.Text.Decoder decoder = System.Text.Encoding.UTF8.GetDecoder();
+ decoder.GetChars(info._dataBuffer, 0, receivedBytesCount, chars, 0);
+ System.String data = new System.String(chars);
+
+ String[] commands = data.Split(new char[] { '\n', '\r', '\0' }, StringSplitOptions.RemoveEmptyEntries);
+ foreach (String cmd in commands)
+ ProcessData(cmd);
+
+ SetupDataCallback(); // Listen to new signals again
+ }
+ catch (ObjectDisposedException)
+ {
+ Console.WriteLine("WLirc: OnDataReceived: Socket has been closed");
+ }
+ catch (SocketException se)
+ {
+ Console.WriteLine("WLirc: OnDataReceived: Socket exception: " + se.Message);
+ }
+ }
+
+ /// <summary>
+ /// Process received data, i.e. send event to event handlers
+ /// </summary>
+ private void ProcessData(String data)
+ {
+ // Ignore commands we do not need (like the startup message)
+ if ((data == "BEGIN") || (data == "END") || (data == "SIGHUP"))
+ return;
+
+ Command command = new Command(data);
+
+ #region Time-based repeat filter
+ if (_lastCommand.IsSameCommand(command))
+ if ((command.Time - _lastCommand.Time) < _buttonReleaseTime)
+ {
+ Console.WriteLine("WLirc: Command '" + command.Button + "' ignored because of repeat filter");
+ return;
+ }
+ #endregion
+
+ Console.WriteLine("WLirc: Command '" + command.Button + "' accepted");
+ _lastCommand = command;
+
+ if (CommandEvent != null)
+ CommandEvent(command);
+ }
+ #endregion
+
+ #region Helper classes
+ /// <summary>
+ /// Class containing information for the data callback function
+ /// </summary>
+ private class SocketInfo
+ {
+ public Socket _socket;
+ public byte[] _dataBuffer = new byte[512];
+ }
+
+ /// <summary>
+ /// Class containing information on a WinLIRC command
+ /// </summary>
+ public class Command
+ {
+ String _remote;
+ String _button;
+ DateTime _time;
+
+ public Command()
+ {
+ _time = DateTime.Now;
+ }
+
+ public Command(string data)
+ {
+ String[] dataElements = data.Split(' ');
+ _button = dataElements[2];
+ _remote = dataElements[3];
+ _time = DateTime.Now;
+ }
+
+ public bool IsSameCommand(Command second)
+ {
+ if ((_button == second._button) && (_remote == second._remote))
+ return true;
+ return false;
+ }
+
+ public String Button { get { return _button; } }
+ public String Remote { get { return _remote; } }
+ public DateTime Time { get { return _time; } }
+ }
+ #endregion
+ }
+}
Modified: trunk/plugins/IR Server Suite/IR Server Suite.sln
===================================================================
--- trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/IR Server Suite.sln 2007-06-06 16:52:56 UTC (rev 489)
@@ -65,6 +65,8 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IR Server Plugin Interface", "IR Server Plugins\IR Server Plugin Interface\IR Server Plugin Interface.csproj", "{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinLirc Receiver", "IR Server Plugins\WinLirc Receiver\WinLirc Receiver.csproj", "{E6A68244-8C31-44A9-9F85-B4A102B5F209}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -179,6 +181,10 @@
{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E6A68244-8C31-44A9-9F85-B4A102B5F209}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -202,6 +208,7 @@
{9FDD649E-0502-4FED-9AC1-AA0346394375} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD}
{8B3CC9D2-A673-4B1B-8BE4-7AA6C0210F84} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD}
{D8B3D28F-62CE-4CA7-86CE-B7EAD614A94C} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD}
+ {E6A68244-8C31-44A9-9F85-B4A102B5F209} = {0D1620EE-01B9-43B5-9FAA-E983BD9EBDBD}
{E98F1F7E-40B6-44C8-AC66-EC867B141FA1} = {0E9CCB69-CEF0-4680-816B-18E949DEA727}
{077B53BB-404A-4B2F-BA17-AAE98C5E9C66} = {0E9CCB69-CEF0-4680-816B-18E949DEA727}
{F4EA6055-7133-4F18-8971-E19ADEB482C1} = {0E9CCB69-CEF0-4680-816B-18E949DEA727}
Modified: trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs
===================================================================
--- trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs 2007-06-03 17:34:14 UTC (rev 488)
+++ trunk/plugins/IR Server Suite/MediaPortal Plugins/TV2 Blaster Plugin/TV2BlasterPlugin.cs 2007-06-06 16:52:56 UTC (rev 489)
@@ -547,7 +547,7 @@
string fileName;
for (int index = 0; index < cardCount; index++)
{
- fileName = String.Format("{0}ExternalChannelConfig{1}.xml", ExtCfgFolder, index + 1);
+ fileName = String.Format("{0}ExternalChannelConfig{1}.xml", ExtCfgFolder, Convert.ToString(index + 1));
try
{
ExternalChannelConfigs[index] = ExternalChannelConfig.Load(fileName);
@@ -557,6 +557,8 @@
ExternalChannelConfigs[index] = new ExternalChannelConfig(fileName);
Log.Error(ex);
}
+
+ ExternalChannelConfigs[index].CardId = index;
}
}
@@ -601,7 +603,7 @@
{
int card = int.Parse(tunerCard);
- // To fix a known bug in MediaPortal scheduled recording (Added: 25-Feb-2007)
+ // To work around a known bug in MediaPortal scheduled recording (Added: 25-Feb-2007)
if (card < 0)
card = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|