From: <an...@us...> - 2008-03-21 07:24:56
|
Revision: 1492 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1492&view=rev Author: and-81 Date: 2008-03-21 00:24:54 -0700 (Fri, 21 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Suite.sln Added Paths: ----------- trunk/plugins/IR Server Suite/Common/IrssScheduler/ trunk/plugins/IR Server Suite/Common/IrssScheduler/IrssScheduler.csproj trunk/plugins/IR Server Suite/Common/IrssScheduler/Properties/ trunk/plugins/IR Server Suite/Common/IrssScheduler/Properties/AssemblyInfo.cs trunk/plugins/IR Server Suite/Common/IrssScheduler/ScheduleEvent.cs trunk/plugins/IR Server Suite/Common/IrssScheduler/Scheduler.cs Added: trunk/plugins/IR Server Suite/Common/IrssScheduler/IrssScheduler.csproj =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssScheduler/IrssScheduler.csproj (rev 0) +++ trunk/plugins/IR Server Suite/Common/IrssScheduler/IrssScheduler.csproj 2008-03-21 07:24:54 UTC (rev 1492) @@ -0,0 +1,47 @@ +<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>{28098574-D22E-457C-AFFA-560554499EAC}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>IrssScheduler</RootNamespace> + <AssemblyName>IrssScheduler</AssemblyName> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="ScheduleEvent.cs" /> + <Compile Include="Scheduler.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </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> + --> +</Project> \ No newline at end of file Added: trunk/plugins/IR Server Suite/Common/IrssScheduler/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssScheduler/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/IR Server Suite/Common/IrssScheduler/Properties/AssemblyInfo.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -0,0 +1,35 @@ +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("IrssScheduler")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("IrssScheduler")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a0d1d4e4-6c74-4199-90fd-68f0e789ff29")] + +// 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.4.2")] +[assembly: AssemblyFileVersion("1.0.4.2")] Added: trunk/plugins/IR Server Suite/Common/IrssScheduler/ScheduleEvent.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssScheduler/ScheduleEvent.cs (rev 0) +++ trunk/plugins/IR Server Suite/Common/IrssScheduler/ScheduleEvent.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.Serialization; + +namespace IrssScheduler +{ + + /// <summary> + /// + /// </summary> + internal class ScheduleEvent + { + + /// <summary> + /// Initializes a new instance of the <see cref="ScheduleEvent"/> class. + /// </summary> + public ScheduleEvent() + { + + } + + + + + + } + +} Added: trunk/plugins/IR Server Suite/Common/IrssScheduler/Scheduler.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssScheduler/Scheduler.cs (rev 0) +++ trunk/plugins/IR Server Suite/Common/IrssScheduler/Scheduler.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.Serialization; + +namespace IrssScheduler +{ + + /// <summary> + /// + /// </summary> + public class Scheduler + { + + List<ScheduleEvent> _scheduleEvents; + + /// <summary> + /// Initializes a new instance of the <see cref="Scheduler"/> class. + /// </summary> + public Scheduler() + { + + _scheduleEvents = new List<ScheduleEvent>(); + + } + + + public void LoadSchedule(string fileName) + { + + } + + public void SaveSchedule(string fileName) + { + + } + + + } + +} Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-03-21 04:49:12 UTC (rev 1491) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -431,13 +431,14 @@ DebugWriteLine("InitializeDevice()"); #endif - WriteSync(ResetPacket); // Added 18-March-2008 to see what SMK devices think of it... WriteSync(StartPacket); // Testing some commands that MCE sends, but I don't know what they mean (what do these get back?) WriteSync(new byte[] { 0xFF, 0x0B }); // Looks like a request for Firmware version WriteSync(new byte[] { 0x9F, 0x05 }); WriteSync(new byte[] { 0x9F, 0x0D }); + WriteSync(new byte[] { 0x9F, 0x13 }); + Thread.Sleep(4 * PacketTimeout); SetTimeout(PacketTimeout); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-03-21 04:49:12 UTC (rev 1491) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -133,7 +133,7 @@ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - static readonly byte[] ResetPacket = { 0xFF, 0xFE }; + static readonly byte[] ResetPacket = { 0xFF, 0xEE }; // Misc Packets static readonly byte[] SetCarrierFreqPacket = { 0x9F, 0x06, 0x01, 0x80 }; @@ -430,13 +430,14 @@ DebugWriteLine("InitializeDevice()"); #endif - WriteSync(ResetPacket); // Added 18-March-2008 to see what SMK devices think of it... WriteSync(StartPacket); // Testing some commands that MCE sends, but I don't know what they mean (what do these get back?) WriteSync(new byte[] { 0xFF, 0x0B }); // Looks like a request for Firmware version WriteSync(new byte[] { 0x9F, 0x05 }); WriteSync(new byte[] { 0x9F, 0x0D }); + WriteSync(new byte[] { 0x9F, 0x13 }); + Thread.Sleep(4 * PacketTimeout); SetTimeout(PacketTimeout); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj 2008-03-21 04:49:12 UTC (rev 1491) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Microsoft MCE Transceiver.csproj 2008-03-21 07:24:54 UTC (rev 1492) @@ -5,12 +5,13 @@ <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{BABC30EB-7D0F-4398-9FCB-E517EA8D2AA9}</ProjectGuid> - <OutputType>Exe</OutputType> + <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>InputService.Plugin</RootNamespace> <AssemblyName>Microsoft MCE Transceiver</AssemblyName> <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent> - <StartupObject>InputService.Plugin.MicrosoftMceTransceiver</StartupObject> + <StartupObject> + </StartupObject> <ApplicationIcon>Icon.ico</ApplicationIcon> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> @@ -30,8 +31,7 @@ <DebugType>none</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> - <DefineConstants> - </DefineConstants> + <DefineConstants>DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-03-21 04:49:12 UTC (rev 1491) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-03-21 07:24:54 UTC (rev 1492) @@ -1,3 +1,5 @@ +//#define TEST_APPLICATION + using System; using System.Collections; using System.Collections.Generic; @@ -53,9 +55,10 @@ public class MicrosoftMceTransceiver : PluginBase, IConfigure, ITransmitIR, ILearnIR, IRemoteReceiver, IKeyboardReceiver, IMouseReceiver { - #region Debug -#if DEBUG +#if TEST_APPLICATION + static MicrosoftMceTransceiver device; + static void xRemote(string deviceName, string code) { Console.WriteLine("Remote: {0}", code); @@ -79,29 +82,132 @@ [STAThread] static void Main() { - MicrosoftMceTransceiver c = new MicrosoftMceTransceiver(); + Console.WriteLine("Microsoft MCE Transceiver Test App"); + Console.WriteLine("===================================="); + Console.WriteLine(); - //c.Configure(null); + SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); - c.RemoteCallback += new RemoteHandler(xRemote); - c.KeyboardCallback += new KeyboardHandler(xKeyboard); - c.MouseCallback += new MouseHandler(xMouse); + try + { + device = new MicrosoftMceTransceiver(); - c.Start(); + Console.Write("Configure device? (y/n) "); - Console.WriteLine("Test App Started"); - Console.WriteLine("====================="); - Console.WriteLine("Press a button on your remote to test ..."); - Console.WriteLine("Press any key to quit ..."); + if (Console.ReadKey().Key == ConsoleKey.Y) + { + Console.WriteLine(); - Console.ReadKey(); + Console.WriteLine("Configuring ..."); + device.Configure(null); + } + else + { + Console.WriteLine(); + } - c.Stop(); - c = null; + device.RemoteCallback += new RemoteHandler(xRemote); + device.KeyboardCallback += new KeyboardHandler(xKeyboard); + device.MouseCallback += new MouseHandler(xMouse); + + Console.WriteLine("Starting device access ..."); + + device.Start(); + + Console.Write("Learn IR? (y/n) "); + + while (Console.ReadKey().Key == ConsoleKey.Y) + { + Console.WriteLine(); + Console.WriteLine("Learning IR Command ..."); + + byte[] data; + + switch (device.Learn(out data)) + { + case LearnStatus.Failure: + Console.WriteLine("Learn process failed!"); + break; + + case LearnStatus.Success: + Console.WriteLine("Learn successful"); + + Console.Write("Blast IR back? (y/n) "); + + if (Console.ReadKey().Key == ConsoleKey.Y) + { + Console.WriteLine(); + Console.WriteLine("Blasting ..."); + + if (device.Transmit("Both", data)) + { + Console.WriteLine("Blasting successful"); + } + else + { + Console.WriteLine("Blasting failure!"); + } + } + else + { + Console.WriteLine(); + } + break; + + case LearnStatus.Timeout: + Console.WriteLine("Learn process timed-out"); + break; + } + + Console.Write("Learn another IR? (y/n) "); + } + Console.WriteLine(); + Console.WriteLine(); + + Console.WriteLine("Press a button on your remote ..."); + + Application.Run(); + + device.Stop(); + } + catch (Exception ex) + { + Console.WriteLine("Error:"); + Console.WriteLine(ex.ToString()); + Console.WriteLine(); + Console.WriteLine(""); + + Console.ReadKey(); + } + finally + { + device = null; + } + + SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); } + static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) + { + Console.WriteLine("Power Event: {0}", Enum.GetName(typeof(PowerModes), e.Mode)); + + switch (e.Mode) + { + + case PowerModes.Suspend: + if (device != null) + device.Suspend(); + break; + + case PowerModes.Resume: + if (device != null) + device.Resume(); + break; + + } + } + #endif - #endregion Debug #region Constants Modified: trunk/plugins/IR Server Suite/IR Server Suite.sln =================================================================== --- trunk/plugins/IR Server Suite/IR Server Suite.sln 2008-03-21 04:49:12 UTC (rev 1491) +++ trunk/plugins/IR Server Suite/IR Server Suite.sln 2008-03-21 07:24:54 UTC (rev 1492) @@ -490,6 +490,12 @@ Release.AspNetCompiler.Debug = "False" EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IrssScheduler", "Common\IrssScheduler\IrssScheduler.csproj", "{28098574-D22E-457C-AFFA-560554499EAC}" + ProjectSection(WebsiteProperties) = preProject + Debug.AspNetCompiler.Debug = "True" + Release.AspNetCompiler.Debug = "False" + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -794,6 +800,10 @@ {58BFF250-541B-4AA4-A62D-ACB819AD317B}.Debug|Any CPU.Build.0 = Debug|Any CPU {58BFF250-541B-4AA4-A62D-ACB819AD317B}.Release|Any CPU.ActiveCfg = Release|Any CPU {58BFF250-541B-4AA4-A62D-ACB819AD317B}.Release|Any CPU.Build.0 = Release|Any CPU + {28098574-D22E-457C-AFFA-560554499EAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28098574-D22E-457C-AFFA-560554499EAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28098574-D22E-457C-AFFA-560554499EAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28098574-D22E-457C-AFFA-560554499EAC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -861,6 +871,7 @@ {08F57DD7-2C6E-484E-9CC5-835F70C5BC64} = {E757F80C-23C5-4AD6-B178-16799E337E03} {BCAFDF45-70DD-46FD-8B98-880DDA585AD2} = {E757F80C-23C5-4AD6-B178-16799E337E03} {28923F6E-8A68-4BC8-A507-825B09C3F64E} = {E757F80C-23C5-4AD6-B178-16799E337E03} + {28098574-D22E-457C-AFFA-560554499EAC} = {E757F80C-23C5-4AD6-B178-16799E337E03} {8ADDE1CB-2D23-4AB1-88B1-A241C60C16BA} = {DEE5AAD1-0110-4681-8FF9-662CEA72FD94} {DC79E2EC-7D1B-4359-A285-38AC8154166B} = {DEE5AAD1-0110-4681-8FF9-662CEA72FD94} {21E04B17-D850-43E7-AAD3-876C0E062BDB} = {F0D3A774-FE5E-4419-B9B6-C11FF1C4BB50} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |