From: <an...@us...> - 2008-04-05 14:15:36
|
Revision: 1606 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1606&view=rev Author: and-81 Date: 2008-04-05 07:15:34 -0700 (Sat, 05 Apr 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Imon/Microsoft MCE.xml trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.csproj Added Paths: ----------- 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/Input Service.exe.manifest Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs 2008-04-05 02:56:41 UTC (rev 1605) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Imon Receiver/Imon Receiver.cs 2008-04-05 14:15:34 UTC (rev 1606) @@ -93,6 +93,9 @@ const uint IOCTL_IMON_FW_VER = 0x00222014; // function 0x805 - read FW version (4 bytes) const uint IOCTL_IMON_READ2 = 0x00222034; // function 0x80D - ??? read (8 bytes) + const uint IMON_PAD_BUTTON = 1000; + const uint IMON_MCE_BUTTON = 2000; + #endregion Constants #region Enumerations @@ -241,7 +244,9 @@ uint _lastRemoteButtonKeyCode = 0; DateTime _lastRemoteButtonTime = DateTime.Now; bool _remoteButtonRepeated = false; - + + byte _remoteToggle = 0x00; + bool _keyboardKeyRepeated = false; DateTime _lastKeyboardKeyTime = DateTime.Now; @@ -584,6 +589,69 @@ #endif } + void ProcessInput(byte[] dataBytes) + { +#if DEBUG + DebugWrite("Data Received: "); + DebugDump(dataBytes); +#endif + + if ((dataBytes[0] & 0xFC) == 0x28) // iMon PAD remote button + { + uint keyCode = IMON_PAD_BUTTON; + keyCode |= (uint)((dataBytes[0] & 0x03) << 6); + keyCode |= (uint)(dataBytes[1] & 0x30); + keyCode |= (uint)((dataBytes[1] & 0x06) << 1); + keyCode |= (uint)((dataBytes[2] & 0x80) >> 6); + + if ((dataBytes[2] & 0x40) == 0) + { + RemoteEvent(keyCode, _remoteToggle != 1); + _remoteToggle = 1; + } + else + { + _remoteToggle = 0; + } + } + else if ((dataBytes[0] & 0xFC) == 0x68) // iMon PAD mouse move/button + { + int xSign = (((dataBytes[0] & 0x02) != 0) ? 1 : -1); + int ySign = (((dataBytes[0] & 0x01) != 0) ? 1 : -1); + int xSize = ((dataBytes[1] & 0x78) >> 3); + int ySize = ((dataBytes[2] & 0x78) >> 3); + + bool right = ((dataBytes[1] & 0x04) != 0); + bool left = ((dataBytes[1] & 0x01) != 0); + + MouseEvent(xSign * xSize, ySign * ySize, right, left); + } + else if (dataBytes[7] == 0xAE) // MCE remote button + { + uint keyCode = IMON_MCE_BUTTON + dataBytes[3]; + + RemoteEvent(keyCode, _remoteToggle != dataBytes[2]); + _remoteToggle = dataBytes[2]; + } + else if (dataBytes[7] == 0xBE) // MCE Keyboard key press + { + KeyboardEvent(dataBytes[2], dataBytes[3]); + } + else if (dataBytes[7] == 0xCE) // MCE Keyboard mouse move/button + { + int xSign = (dataBytes[2] & 0x20) == 0 ? 1 : -1; + int ySign = (dataBytes[1] & 0x10) == 0 ? 1 : -1; + + int xSize = (dataBytes[3] & 0x0F); + int ySize = (dataBytes[2] & 0x0F); + + bool right = (dataBytes[3] & 0x40) != 0; + bool left = (dataBytes[3] & 0x20) != 0; + + MouseEvent(xSign * xSize, ySign * ySize, right, left); + } + } + void ReceiveThread() { #if DEBUG @@ -607,48 +675,10 @@ byte[] dataBytes = new byte[bytesRead]; Marshal.Copy(deviceBufferPtr, dataBytes, 0, bytesRead); -#if DEBUG - DebugWrite("Data Received: "); - DebugDump(dataBytes); -#endif + if (dataBytes[0] != 0xFF && dataBytes[0] != 0x00) + ProcessInput(dataBytes); - switch (dataBytes[7]) - { - case 0xAE: // Remote button - RemoteEvent(dataBytes[3], false); - break; - - case 0xBE: // MCE Keyboard Key - KeyboardEvent(dataBytes[2], dataBytes[3]); - break; - - case 0xCE: // MCE Keyboard mouse report - int x = 0; - int y = 0; - bool right = false; - bool left = false; - /* - if ((dataBytes[2] & 0x20) != 0) x |= 1 << 7; // sign bit - if ((dataBytes[2] & 0x80) != 0) x |= 1 << 4; - if ((dataBytes[2] & 0x40) != 0) x |= 1 << 3; - if ((dataBytes[3] & 0x08) != 0) x |= 1 << 2; - if ((dataBytes[3] & 0x04) != 0) x |= 1 << 1; - if ((dataBytes[3] & 0x02) != 0) x |= 1; - - if ((dataBytes[1] & 0x10) != 0) y |= 1 << 7; // sign bit - if ((dataBytes[1] & 0x20) != 0) y |= 1 << 4; - if ((dataBytes[2] & 0x08) != 0) y |= 1 << 3; - if ((dataBytes[2] & 0x04) != 0) y |= 1 << 2; - if ((dataBytes[2] & 0x02) != 0) y |= 1 << 1; - if ((dataBytes[2] & 0x01) != 0) y |= 1; - */ - - if ((dataBytes[3] & 0x40) != 0) right = true; - if ((dataBytes[3] & 0x20) != 0) left = true; - - MouseEvent(x, y, right, left); - break; - } + Thread.Sleep(50); } } } @@ -777,7 +807,7 @@ void KeyboardEvent(uint keyCode, uint modifiers) { #if DEBUG - DebugWriteLine("RemoteEvent: {0}, {1}", keyCode, modifiers); + DebugWriteLine("KeyboardEvent: {0}, {1}", keyCode, modifiers); #endif if (!_enableKeyboardInput) Added: 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 (rev 0) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Imon/Imon PAD.xml 2008-04-05 14:15:34 UTC (rev 1606) @@ -0,0 +1,58 @@ +<?xml version="1.0" standalone="yes"?> +<DocumentElement> + <RemoteTable RawCode="?1" AbstractButton="Up" /> + <RemoteTable RawCode="?2" AbstractButton="Down" /> + <RemoteTable RawCode="?3" AbstractButton="Left" /> + <RemoteTable RawCode="?4" AbstractButton="Right" /> + <RemoteTable RawCode="1148" AbstractButton="OK" /> + <RemoteTable RawCode="1038" AbstractButton="VolumeUp" /> + <RemoteTable RawCode="1042" AbstractButton="VolumeDown" /> + <RemoteTable RawCode="1022" AbstractButton="ChannelUp" /> + <RemoteTable RawCode="1014" AbstractButton="ChannelDown" /> + <RemoteTable RawCode="1178" AbstractButton="Start" /> + <RemoteTable RawCode="1032" AbstractButton="Back" /> + <RemoteTable RawCode="?5" AbstractButton="Info" /> + <RemoteTable RawCode="1218" AbstractButton="Mute" /> + <RemoteTable RawCode="1234" AbstractButton="Number0" /> + <RemoteTable RawCode="1058" AbstractButton="Number1" /> + <RemoteTable RawCode="1242" AbstractButton="Number2" /> + <RemoteTable RawCode="1050" AbstractButton="Number3" /> + <RemoteTable RawCode="1138" AbstractButton="Number4" /> + <RemoteTable RawCode="1090" AbstractButton="Number5" /> + <RemoteTable RawCode="1170" AbstractButton="Number6" /> + <RemoteTable RawCode="1214" AbstractButton="Number7" /> + <RemoteTable RawCode="1136" AbstractButton="Number8" /> + <RemoteTable RawCode="1160" AbstractButton="Number9" /> + <RemoteTable RawCode="1128" AbstractButton="Play" /> + <RemoteTable RawCode="1144" AbstractButton="Pause" /> + <RemoteTable RawCode="1220" AbstractButton="Stop" /> + <RemoteTable RawCode="1192" AbstractButton="FastForward" /> + <RemoteTable RawCode="1130" AbstractButton="Rewind" /> + <RemoteTable RawCode="1064" AbstractButton="Record" /> + <RemoteTable RawCode="1066" AbstractButton="NextChapter" /> + <RemoteTable RawCode="1208" AbstractButton="PreviousChapter" /> + <RemoteTable RawCode="1002" AbstractButton="Power" /> + <RemoteTable RawCode="1016" AbstractButton="Power2" /> + <RemoteTable RawCode="?6" AbstractButton="Teletext" /> + <RemoteTable RawCode="?7" AbstractButton="Red" /> + <RemoteTable RawCode="?8" AbstractButton="Green" /> + <RemoteTable RawCode="?9" AbstractButton="Yellow" /> + <RemoteTable RawCode="?10" AbstractButton="Blue" /> + <RemoteTable RawCode="1252" AbstractButton="Clear" /> + <RemoteTable RawCode="1034" AbstractButton="Enter" /> + <RemoteTable RawCode="1096" AbstractButton="Hash" /> + <RemoteTable RawCode="1056" AbstractButton="Star" /> + <RemoteTable RawCode="1082" AbstractButton="Music" /> + <RemoteTable RawCode="1224" AbstractButton="Pictures" /> + <RemoteTable RawCode="1200" AbstractButton="Videos" /> + <RemoteTable RawCode="1102" AbstractButton="DVD" /> + <RemoteTable RawCode="1040" AbstractButton="TV" /> + <RemoteTable RawCode="?11" AbstractButton="Guide" /> + <RemoteTable RawCode="?12" AbstractButton="LiveTV" /> + <RemoteTable RawCode="?13" AbstractButton="Radio" /> + <RemoteTable RawCode="?14" AbstractButton="Print" /> + <RemoteTable RawCode="?15" AbstractButton="RecordedTV" /> + <RemoteTable RawCode="1106" AbstractButton="AspectRatio" /> + <RemoteTable RawCode="?16" AbstractButton="Print" /> + <RemoteTable RawCode="?17" AbstractButton="Messenger" /> +</DocumentElement> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Imon/Microsoft MCE.xml =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Imon/Microsoft MCE.xml 2008-04-05 02:56:41 UTC (rev 1605) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Abstract Remote Maps/Imon/Microsoft MCE.xml 2008-04-05 14:15:34 UTC (rev 1606) @@ -1,58 +1,58 @@ <?xml version="1.0" standalone="yes"?> <DocumentElement> - <RemoteTable RawCode="30" AbstractButton="Up" /> - <RemoteTable RawCode="31" AbstractButton="Down" /> - <RemoteTable RawCode="32" AbstractButton="Left" /> - <RemoteTable RawCode="33" AbstractButton="Right" /> - <RemoteTable RawCode="34" AbstractButton="OK" /> - <RemoteTable RawCode="16" AbstractButton="VolumeUp" /> - <RemoteTable RawCode="17" AbstractButton="VolumeDown" /> - <RemoteTable RawCode="18" AbstractButton="ChannelUp" /> - <RemoteTable RawCode="19" AbstractButton="ChannelDown" /> - <RemoteTable RawCode="13" AbstractButton="Start" /> - <RemoteTable RawCode="35" AbstractButton="Back" /> - <RemoteTable RawCode="15" AbstractButton="Info" /> - <RemoteTable RawCode="14" AbstractButton="Mute" /> - <RemoteTable RawCode="0" AbstractButton="Number0" /> - <RemoteTable RawCode="1" AbstractButton="Number1" /> - <RemoteTable RawCode="2" AbstractButton="Number2" /> - <RemoteTable RawCode="3" AbstractButton="Number3" /> - <RemoteTable RawCode="4" AbstractButton="Number4" /> - <RemoteTable RawCode="5" AbstractButton="Number5" /> - <RemoteTable RawCode="6" AbstractButton="Number6" /> - <RemoteTable RawCode="7" AbstractButton="Number7" /> - <RemoteTable RawCode="8" AbstractButton="Number8" /> - <RemoteTable RawCode="9" AbstractButton="Number9" /> - <RemoteTable RawCode="22" AbstractButton="Play" /> - <RemoteTable RawCode="24" AbstractButton="Pause" /> - <RemoteTable RawCode="25" AbstractButton="Stop" /> - <RemoteTable RawCode="20" AbstractButton="FastForward" /> - <RemoteTable RawCode="21" AbstractButton="Rewind" /> - <RemoteTable RawCode="23" AbstractButton="Record" /> - <RemoteTable RawCode="26" AbstractButton="NextChapter" /> - <RemoteTable RawCode="27" AbstractButton="PreviousChapter" /> - <RemoteTable RawCode="101" AbstractButton="Power" /> - <RemoteTable RawCode="12" AbstractButton="Power2" /> - <RemoteTable RawCode="90" AbstractButton="Teletext" /> - <RemoteTable RawCode="91" AbstractButton="Red" /> - <RemoteTable RawCode="92" AbstractButton="Green" /> - <RemoteTable RawCode="93" AbstractButton="Yellow" /> - <RemoteTable RawCode="94" AbstractButton="Blue" /> - <RemoteTable RawCode="10" AbstractButton="Clear" /> - <RemoteTable RawCode="11" AbstractButton="Enter" /> - <RemoteTable RawCode="28" AbstractButton="Hash" /> - <RemoteTable RawCode="29" AbstractButton="Star" /> - <RemoteTable RawCode="71" AbstractButton="Music" /> - <RemoteTable RawCode="73" AbstractButton="Pictures" /> - <RemoteTable RawCode="74" AbstractButton="Videos" /> - <RemoteTable RawCode="36" AbstractButton="DVD" /> - <RemoteTable RawCode="70" AbstractButton="TV" /> - <RemoteTable RawCode="38" AbstractButton="Guide" /> - <RemoteTable RawCode="37" AbstractButton="LiveTV" /> - <RemoteTable RawCode="80" AbstractButton="Radio" /> - <RemoteTable RawCode="78" AbstractButton="Print" /> - <RemoteTable RawCode="72" AbstractButton="RecordedTV" /> - <RemoteTable RawCode="39" AbstractButton="AspectRatio" /> - <RemoteTable RawCode="78" AbstractButton="Print" /> - <RemoteTable RawCode="105" AbstractButton="Messenger" /> + <RemoteTable RawCode="2030" AbstractButton="Up" /> + <RemoteTable RawCode="2031" AbstractButton="Down" /> + <RemoteTable RawCode="2032" AbstractButton="Left" /> + <RemoteTable RawCode="2033" AbstractButton="Right" /> + <RemoteTable RawCode="2034" AbstractButton="OK" /> + <RemoteTable RawCode="2016" AbstractButton="VolumeUp" /> + <RemoteTable RawCode="2017" AbstractButton="VolumeDown" /> + <RemoteTable RawCode="2018" AbstractButton="ChannelUp" /> + <RemoteTable RawCode="2019" AbstractButton="ChannelDown" /> + <RemoteTable RawCode="2013" AbstractButton="Start" /> + <RemoteTable RawCode="2035" AbstractButton="Back" /> + <RemoteTable RawCode="2015" AbstractButton="Info" /> + <RemoteTable RawCode="2014" AbstractButton="Mute" /> + <RemoteTable RawCode="2000" AbstractButton="Number0" /> + <RemoteTable RawCode="2001" AbstractButton="Number1" /> + <RemoteTable RawCode="2002" AbstractButton="Number2" /> + <RemoteTable RawCode="2003" AbstractButton="Number3" /> + <RemoteTable RawCode="2004" AbstractButton="Number4" /> + <RemoteTable RawCode="2005" AbstractButton="Number5" /> + <RemoteTable RawCode="2006" AbstractButton="Number6" /> + <RemoteTable RawCode="2007" AbstractButton="Number7" /> + <RemoteTable RawCode="2008" AbstractButton="Number8" /> + <RemoteTable RawCode="2009" AbstractButton="Number9" /> + <RemoteTable RawCode="2022" AbstractButton="Play" /> + <RemoteTable RawCode="2024" AbstractButton="Pause" /> + <RemoteTable RawCode="2025" AbstractButton="Stop" /> + <RemoteTable RawCode="2020" AbstractButton="FastForward" /> + <RemoteTable RawCode="2021" AbstractButton="Rewind" /> + <RemoteTable RawCode="2023" AbstractButton="Record" /> + <RemoteTable RawCode="2026" AbstractButton="NextChapter" /> + <RemoteTable RawCode="2027" AbstractButton="PreviousChapter" /> + <RemoteTable RawCode="2101" AbstractButton="Power" /> + <RemoteTable RawCode="2012" AbstractButton="Power2" /> + <RemoteTable RawCode="2090" AbstractButton="Teletext" /> + <RemoteTable RawCode="2091" AbstractButton="Red" /> + <RemoteTable RawCode="2092" AbstractButton="Green" /> + <RemoteTable RawCode="2093" AbstractButton="Yellow" /> + <RemoteTable RawCode="2094" AbstractButton="Blue" /> + <RemoteTable RawCode="2010" AbstractButton="Clear" /> + <RemoteTable RawCode="2011" AbstractButton="Enter" /> + <RemoteTable RawCode="2028" AbstractButton="Hash" /> + <RemoteTable RawCode="2029" AbstractButton="Star" /> + <RemoteTable RawCode="2071" AbstractButton="Music" /> + <RemoteTable RawCode="2073" AbstractButton="Pictures" /> + <RemoteTable RawCode="2074" AbstractButton="Videos" /> + <RemoteTable RawCode="2036" AbstractButton="DVD" /> + <RemoteTable RawCode="2070" AbstractButton="TV" /> + <RemoteTable RawCode="2038" AbstractButton="Guide" /> + <RemoteTable RawCode="2037" AbstractButton="LiveTV" /> + <RemoteTable RawCode="2080" AbstractButton="Radio" /> + <RemoteTable RawCode="2078" AbstractButton="Print" /> + <RemoteTable RawCode="2072" AbstractButton="RecordedTV" /> + <RemoteTable RawCode="2039" AbstractButton="AspectRatio" /> + <RemoteTable RawCode="2078" AbstractButton="Print" /> + <RemoteTable RawCode="2105" AbstractButton="Messenger" /> </DocumentElement> \ No newline at end of file Modified: trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.csproj =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.csproj 2008-04-05 02:56:41 UTC (rev 1605) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.csproj 2008-04-05 14:15:34 UTC (rev 1606) @@ -106,6 +106,7 @@ </Content> </ItemGroup> <ItemGroup> + <Content Include="Abstract Remote Maps\Imon\Imon PAD.xml" /> <Content Include="Abstract Remote Maps\Imon\Microsoft MCE.xml" /> <Content Include="Input Service.exe.manifest"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> Added: trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.exe.manifest =================================================================== --- trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.exe.manifest (rev 0) +++ trunk/plugins/IR Server Suite/Input Service/Input Service/Input Service.exe.manifest 2008-04-05 14:15:34 UTC (rev 1606) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" > + <assemblyIdentity name="Input Service" version="1.4.2.0" publicKeyToken="dc0b77bf2c754d95" processorArchitecture="msil" /> + <description>Provides multiple connections for local and network access to attached input devices</description> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel> + </requestedPrivileges> + </security> + </trustInfo> +</assembly> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |