From: <an...@us...> - 2008-02-17 01:37:16
|
Revision: 1382 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1382&view=rev Author: and-81 Date: 2008-02-16 17:37:14 -0800 (Sat, 16 Feb 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs trunk/plugins/IR Server Suite/Common/IrssComms/Client.cs trunk/plugins/IR Server Suite/Documentation/new.html trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs trunk/plugins/MCEReplacement/Forms/LearnIR.cs trunk/plugins/MCEReplacement/Forms/MacroEditor.cs trunk/plugins/MCEReplacement/Forms/SetupForm.cs trunk/plugins/MCEReplacement/Forms/StbSetup.cs trunk/plugins/MCEReplacement/InputMapper/InputMappingForm.cs trunk/plugins/MCEReplacement/MCEReplacement.cs Property Changed: ---------------- trunk/plugins/RC102 Plugin/ Modified: trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/Applications/IR Blast/Program.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -98,7 +98,6 @@ else { IPAddress serverIP = Client.GetIPFromName(_serverHost); - IPEndPoint endPoint = new IPEndPoint(serverIP, IrssComms.Server.DefaultPort); if (StartClient(endPoint)) Modified: trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/Applications/IR Blast (No Window)/Program.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -97,7 +97,6 @@ else { IPAddress serverIP = Client.GetIPFromName(_serverHost); - IPEndPoint endPoint = new IPEndPoint(serverIP, IrssComms.Server.DefaultPort); if (StartClient(endPoint)) Modified: trunk/plugins/IR Server Suite/Common/IrssComms/Client.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssComms/Client.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/Common/IrssComms/Client.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -357,14 +357,17 @@ /// <summary> - /// Translates a host name or address into an IPAddress object. + /// Translates a host name or address into an IPAddress object (IPv4). /// </summary> /// <param name="name">Host name or IP address.</param> /// <returns>IPAddress object.</returns> public static IPAddress GetIPFromName(string name) { + // Automatically convert localhost to loopback address, avoiding lookup calls for systems that aren't on a network. + if (name.Equals("localhost", StringComparison.OrdinalIgnoreCase)) + return IPAddress.Loopback; + IPAddress[] addresses = Dns.GetHostAddresses(name); - foreach (IPAddress address in addresses) if (address.AddressFamily == AddressFamily.InterNetwork) return address; Modified: trunk/plugins/IR Server Suite/Documentation/new.html =================================================================== --- trunk/plugins/IR Server Suite/Documentation/new.html 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/Documentation/new.html 2008-02-17 01:37:14 UTC (rev 1382) @@ -35,6 +35,7 @@ <LI>MCE Remote Receiver: Can now set remote and keyboard repeat rates to mimic system keyboard repeat rate settings.</LI> <LI>IR Server Plugin: Added support for HCW (Hauppauge) Receiver - Experimental.</LI> <LI>Translator: Added a "remap" button for changing the button associated with a command.</LI> +<LI>TCP Comms: Automatically map "localhost" to loopback address, avoiding the lookup process. This <i>might</i> solve a problem for some users.</LI> </UL></P> <BR> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/Custom HID Receiver.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -22,9 +22,19 @@ static void Remote(string code) { - Console.WriteLine(code); + Console.WriteLine("Remote: {0}", code); } + static void Keyboard(int button, bool up) + { + Console.WriteLine("Keyboard: {0}, {1}", button, up); + } + + static void Mouse(int x, int y, int buttons) + { + Console.WriteLine("Mouse: ({0}, {1}) - {2}", x, y, buttons); + } + [STAThread] static void Main() { @@ -33,16 +43,15 @@ c.Configure(null); c.RemoteCallback += new RemoteHandler(Remote); + c.KeyboardCallback += new KeyboardHandler(Keyboard); + c.MouseCallback += new MouseHandler(Mouse); - c.Start(); Application.Run(); c.Stop(); c = null; - - } #region Constants @@ -376,9 +385,11 @@ Trace.WriteLine(String.Format("Extra: {0}", raw.mouse.ulExtraInformation)); Trace.WriteLine(String.Format("Button Data: {0}", raw.mouse.buttonsStr.usButtonData)); Trace.WriteLine(String.Format("Button Flags: {0}", raw.mouse.buttonsStr.usButtonFlags)); + Trace.WriteLine(String.Format("Last X: {0}", raw.mouse.lLastX)); + Trace.WriteLine(String.Format("Last Y: {0}", raw.mouse.lLastY)); #endif - //if (_mouseHandler != null) - //_mouseHandler(0, 0, (int)raw.mouse.ulButtons); + if (_mouseHandler != null) + _mouseHandler(raw.mouse.lLastX, raw.mouse.lLastY, (int)raw.mouse.ulButtons); break; } 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-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Custom HID Receiver/RawInput.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -11,6 +11,9 @@ namespace InputService.Plugin { + /// <summary> + /// Device Details used to register for raw input. + /// </summary> internal class DeviceDetails { string _name; @@ -18,21 +21,37 @@ ushort _usagePage; ushort _usage; + /// <summary> + /// Gets or sets the name. + /// </summary> + /// <value>The name.</value> public string Name { get { return _name; } set { _name = value; } } + /// <summary> + /// Gets or sets the ID. + /// </summary> + /// <value>The ID.</value> public string ID { get { return _id; } set { _id = value; } } + /// <summary> + /// Gets or sets the usage page. + /// </summary> + /// <value>The usage page.</value> public ushort UsagePage { get { return _usagePage; } set { _usagePage = value; } } + /// <summary> + /// Gets or sets the usage. + /// </summary> + /// <value>The usage.</value> public ushort Usage { get { return _usage; } Modified: trunk/plugins/MCEReplacement/Forms/LearnIR.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/LearnIR.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/Forms/LearnIR.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -30,7 +30,7 @@ InitializeComponent(); comboBoxPort.Items.Clear(); - comboBoxPort.Items.AddRange(Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort))); + comboBoxPort.Items.AddRange(Enum.GetNames(typeof(InputService.Plugin.BlasterPort))); comboBoxPort.SelectedIndex = 0; labelLearned.Text = "Not yet learned"; @@ -90,21 +90,21 @@ string fileName = MCEReplacement.IRFolder + name + Common.FileExtensionIR; - IRServerPluginInterface.LearnStatus status = MCEReplacement.LearnIR(fileName); + InputService.Plugin.LearnStatus status = MCEReplacement.LearnIR(fileName); switch (status) { - case IRServerPluginInterface.LearnStatus.Failure: + case InputService.Plugin.LearnStatus.Failure: labelLearned.Text = "Failed to learn IR command"; labelLearned.ForeColor = Color.Red; break; - case IRServerPluginInterface.LearnStatus.Timeout: + case InputService.Plugin.LearnStatus.Timeout: labelLearned.Text = "IR learning timed-out"; labelLearned.ForeColor = Color.Blue; break; - case IRServerPluginInterface.LearnStatus.Success: + case InputService.Plugin.LearnStatus.Success: labelLearned.Text = "Successfully learned IR command"; labelLearned.ForeColor = Color.Green; buttonTest.Enabled = true; Modified: trunk/plugins/MCEReplacement/Forms/MacroEditor.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/MacroEditor.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/Forms/MacroEditor.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -307,7 +307,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.OK) @@ -551,7 +551,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), commands); if (blastCommand.ShowDialog(this) == DialogResult.OK) Modified: trunk/plugins/MCEReplacement/Forms/SetupForm.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/SetupForm.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/Forms/SetupForm.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -16,7 +16,6 @@ using MediaPortal.Hardware; using MediaPortal.Util; -using MicrosoftMceTransceiver; using IrssUtils; using IrssUtils.Forms; using MPUtils.Forms; @@ -531,7 +530,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.OK) @@ -830,7 +829,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), commands); if (blastCommand.ShowDialog(this) == DialogResult.OK) Modified: trunk/plugins/MCEReplacement/Forms/StbSetup.cs =================================================================== --- trunk/plugins/MCEReplacement/Forms/StbSetup.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/Forms/StbSetup.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -256,7 +256,7 @@ blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.STBFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), command.Substring(Common.CmdPrefixSTB.Length), blastCommandCount--); @@ -281,7 +281,7 @@ blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.STBFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), command.Substring(Common.CmdPrefixSTB.Length)); listViewExternalCommands.Items[i].SubItems[1].Text = Common.CmdPrefixSTB + blastCommand.CommandString; @@ -348,7 +348,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), commands); if (blastCommand.ShowDialog(this) == DialogResult.OK) @@ -361,7 +361,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.STBFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), commands); if (blastCommand.ShowDialog(this) == DialogResult.OK) @@ -490,7 +490,7 @@ BlastCommand blastCommand = new BlastCommand( new BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), selected.Substring(Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.OK) Modified: trunk/plugins/MCEReplacement/InputMapper/InputMappingForm.cs =================================================================== --- trunk/plugins/MCEReplacement/InputMapper/InputMappingForm.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/InputMapper/InputMappingForm.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -1906,7 +1906,7 @@ BlastCommand blastCommand = new BlastCommand( new IrssUtils.BlastIrDelegate(MCEReplacement.BlastIR), MCEReplacement.IRFolder, - Enum.GetNames(typeof(MicrosoftMceTransceiver.BlasterPort)), + Enum.GetNames(typeof(InputService.Plugin.BlasterPort)), text.Substring(IrssUtils.Common.CmdPrefixBlast.Length)); if (blastCommand.ShowDialog(this) == DialogResult.OK) Modified: trunk/plugins/MCEReplacement/MCEReplacement.cs =================================================================== --- trunk/plugins/MCEReplacement/MCEReplacement.cs 2008-02-16 22:49:32 UTC (rev 1381) +++ trunk/plugins/MCEReplacement/MCEReplacement.cs 2008-02-17 01:37:14 UTC (rev 1382) @@ -23,7 +23,8 @@ using MediaPortal.Player; using MediaPortal.Util; -using MicrosoftMceTransceiver; +using InputService.Plugin; + using IrssUtils; using IrssUtils.Forms; using MPUtils; @@ -71,7 +72,7 @@ #region Variables - static MicrosoftMceTransceiver.MicrosoftMceTransceiver _mceTransceiver; + static InputService.Plugin.MicrosoftMceTransceiver _mceTransceiver; static bool _logVerbose; static bool _requireFocus; @@ -122,7 +123,7 @@ /// Gets or sets the mce transceiver. /// </summary> /// <value>The mce transceiver.</value> - internal static MicrosoftMceTransceiver.MicrosoftMceTransceiver MceTransceiver + internal static InputService.Plugin.MicrosoftMceTransceiver MceTransceiver { get { return _mceTransceiver; } set { _mceTransceiver = value; } @@ -359,8 +360,8 @@ { try { - _mceTransceiver = new MicrosoftMceTransceiver.MicrosoftMceTransceiver(); - _mceTransceiver.RemoteCallback = new IRServerPluginInterface.RemoteHandler(RemoteButtonReceived); + _mceTransceiver = new MicrosoftMceTransceiver(); + _mceTransceiver.RemoteCallback = new RemoteHandler(RemoteButtonReceived); _mceTransceiver.Start(); } catch (Exception ex) @@ -487,8 +488,8 @@ try { - _mceTransceiver = new MicrosoftMceTransceiver.MicrosoftMceTransceiver(); - _mceTransceiver.RemoteCallback = new IRServerPluginInterface.RemoteHandler(setupForm.ReceivedRemoteButton); + _mceTransceiver = new MicrosoftMceTransceiver(); + _mceTransceiver.RemoteCallback = new RemoteHandler(setupForm.ReceivedRemoteButton); while (true) { @@ -925,6 +926,9 @@ Log.Info("MCEReplacement: Tune request - Card: {0}, Channel: {1}", msg.Label2, msg.Label); + if (_externalChannelConfigs == null) + throw new ApplicationException("Cannot process tune request, no STB settings are loaded"); + try { Thread newThread = new Thread(new ParameterizedThreadStart(ProcessExternalChannel)); @@ -1475,16 +1479,22 @@ /// </summary> /// <param name="fileName">File to place learned IR command in (absolute path).</param> /// <returns><c>true</c> if successful, otherwise <c>false</c>.</returns> - internal static IRServerPluginInterface.LearnStatus LearnIR(string fileName) + internal static LearnStatus LearnIR(string fileName) { - IRServerPluginInterface.LearnStatus status = IRServerPluginInterface.LearnStatus.Failure; + LearnStatus status = LearnStatus.Failure; + if (_mceTransceiver == null) + { + Log.Warn("MCEReplacement: Cannot learn IR, device interface not started"); + return status; + } + try { byte[] data; status = _mceTransceiver.Learn(out data); - if (status == IRServerPluginInterface.LearnStatus.Success) + if (status == LearnStatus.Success) { if (data == null || data.Length == 0) throw new ApplicationException("No data learned"); @@ -1511,6 +1521,12 @@ if (LogVerbose) Log.Debug("MCEReplacement - BlastIR(): {0}, {1}", fileName, port); + if (_mceTransceiver == null) + { + Log.Warn("MCEReplacement: Cannot blast IR, device interface not started"); + return; + } + using (FileStream file = File.OpenRead(fileName)) { if (file.Length == 0) Property changes on: trunk/plugins/RC102 Plugin ___________________________________________________________________ Name: svn:ignore + obj bin *.suo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |