From: <an...@us...> - 2007-12-13 05:23:19
|
Revision: 1150 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1150&view=rev Author: and-81 Date: 2007-12-12 21:23:17 -0800 (Wed, 12 Dec 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IrDecoder.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/IrDecoder.cs trunk/plugins/IR Server Suite/Util Apps/IR File Tool/IrDecoder.cs Modified: trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IrDecoder.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IrDecoder.cs 2007-12-12 13:40:28 UTC (rev 1149) +++ trunk/plugins/IR Server Suite/IR Server Plugins/IgorPlug Receiver/IrDecoder.cs 2007-12-13 05:23:17 UTC (rev 1150) @@ -1158,7 +1158,7 @@ { RC6_Data.State = RemoteDetectionState.HeaderSpace; RC6_Data.Header = 0x000FC000; - RC6_Data.Bit = 14; + RC6_Data.Bit = 12; RC6_Data.HalfBit = 0; RC6_Data.Code = 0; RC6_Data.LongPulse = false; @@ -1174,7 +1174,6 @@ if (!pulse && IsBetween(duration, 750, 1000)) { RC6_Data.State = RemoteDetectionState.PreData; - RC6_Data.Bit -= 2; ignored = false; } break; @@ -1233,7 +1232,6 @@ else { RC6_Data.HalfBit = 1; - //RC6_Data.LongPulse = true; RC6_Data.LongSpace = true; RC6_Data.Bit = 0; RC6_Data.Toggle |= 1; @@ -1247,10 +1245,10 @@ { RC6_Data.Bit = 16; } - else if (RC6_Data.Header == PrefixRC6Foxtel) - { - RC6_Data.Bit = 20; - } + //else if (RC6_Data.Header == PrefixRC6Foxtel) + //{ + //RC6_Data.Bit = 20; + //} else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) { RC6_Data.Bit = 32; @@ -1378,9 +1376,10 @@ else RC6_Data.Toggle = 4; - if (RC6_Data.Header == PrefixRC6Foxtel) - protocolVariation = IrProtocol.RC6_Foxtel; - else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + //if (RC6_Data.Header == PrefixRC6Foxtel) + //protocolVariation = IrProtocol.RC6_Foxtel; + //else + if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) protocolVariation = IrProtocol.RC6A; } 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 2007-12-12 13:40:28 UTC (rev 1149) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2007-12-13 05:23:17 UTC (rev 1150) @@ -871,51 +871,67 @@ /// <returns>Timing data.</returns> static int[] GetTimingDataFromPacket(byte[] packet) { - List<int> timingData = new List<int>(); - - int len = 0; - - for (int index = 0; index < packet.Length; ) + // TODO: Remove this try/catch block once the IndexOutOfRangeException is corrected... +#if DEBUG + try +#endif { - byte curByte = packet[index]; + List<int> timingData = new List<int>(); - if (curByte == 0x9F) - break; + int len = 0; - if (curByte < 0x81 || curByte > 0x8F) - return null; - - int bytes = curByte & 0x7F; - int j; - - for (j = index + 1; j < index + bytes + 1; j++) + for (int index = 0; index < packet.Length; ) { - curByte = packet[j]; + byte curByte = packet[index]; - if ((curByte & 0x80) != 0) - len += (int)(curByte & 0x7F); - else - len -= (int)curByte; + if (curByte == 0x9F) + break; - if ((curByte & 0x7F) != 0x7F) + if (curByte < 0x81 || curByte > 0x8F) + return null; + + int bytes = curByte & 0x7F; + int j; + + for (j = index + 1; j < index + bytes + 1; j++) { - timingData.Add(len * 50); - len = 0; + curByte = packet[j]; + + if ((curByte & 0x80) != 0) + len += (int)(curByte & 0x7F); + else + len -= (int)curByte; + + if ((curByte & 0x7F) != 0x7F) + { + timingData.Add(len * 50); + len = 0; + } } + + index = j; } - index = j; - } + if (len != 0) + timingData.Add(len * 50); - if (len != 0) - timingData.Add(len * 50); +#if DEBUG + DebugWriteLine("Received:"); + DebugDump(timingData.ToArray()); +#endif + return timingData.ToArray(); + } #if DEBUG - DebugWriteLine("Received:"); - DebugDump(timingData.ToArray()); + catch (IndexOutOfRangeException ex) + { + DebugWriteLine(ex.ToString()); + DebugWriteLine("Method Input:"); + DebugDump(packet); + + throw; + } #endif - - return timingData.ToArray(); } /// <summary> Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrDecoder.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrDecoder.cs 2007-12-12 13:40:28 UTC (rev 1149) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrDecoder.cs 2007-12-13 05:23:17 UTC (rev 1150) @@ -1158,7 +1158,7 @@ { RC6_Data.State = RemoteDetectionState.HeaderSpace; RC6_Data.Header = 0x000FC000; - RC6_Data.Bit = 14; + RC6_Data.Bit = 12; RC6_Data.HalfBit = 0; RC6_Data.Code = 0; RC6_Data.LongPulse = false; @@ -1174,7 +1174,6 @@ if (!pulse && IsBetween(duration, 750, 1000)) { RC6_Data.State = RemoteDetectionState.PreData; - RC6_Data.Bit -= 2; ignored = false; } break; @@ -1233,7 +1232,6 @@ else { RC6_Data.HalfBit = 1; - //RC6_Data.LongPulse = true; RC6_Data.LongSpace = true; RC6_Data.Bit = 0; RC6_Data.Toggle |= 1; @@ -1247,10 +1245,10 @@ { RC6_Data.Bit = 16; } - else if (RC6_Data.Header == PrefixRC6Foxtel) - { - RC6_Data.Bit = 20; - } + //else if (RC6_Data.Header == PrefixRC6Foxtel) + //{ + //RC6_Data.Bit = 20; + //} else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) { RC6_Data.Bit = 32; @@ -1378,9 +1376,10 @@ else RC6_Data.Toggle = 4; - if (RC6_Data.Header == PrefixRC6Foxtel) - protocolVariation = IrProtocol.RC6_Foxtel; - else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + //if (RC6_Data.Header == PrefixRC6Foxtel) + //protocolVariation = IrProtocol.RC6_Foxtel; + //else + if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) protocolVariation = IrProtocol.RC6A; } Modified: trunk/plugins/IR Server Suite/Util Apps/IR File Tool/IrDecoder.cs =================================================================== --- trunk/plugins/IR Server Suite/Util Apps/IR File Tool/IrDecoder.cs 2007-12-12 13:40:28 UTC (rev 1149) +++ trunk/plugins/IR Server Suite/Util Apps/IR File Tool/IrDecoder.cs 2007-12-13 05:23:17 UTC (rev 1150) @@ -1147,7 +1147,7 @@ bool pulse = (timingData[i] > 0); bool ignored = true; - //Trace.WriteLine(String.Format("RC6 - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), RC6_Data.State), timingData[i])); + Trace.WriteLine(String.Format("RC6 - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), RC6_Data.State), timingData[i])); switch (RC6_Data.State) { @@ -1158,7 +1158,7 @@ { RC6_Data.State = RemoteDetectionState.HeaderSpace; RC6_Data.Header = 0x000FC000; - RC6_Data.Bit = 14; + RC6_Data.Bit = 12; RC6_Data.HalfBit = 0; RC6_Data.Code = 0; RC6_Data.LongPulse = false; @@ -1174,7 +1174,6 @@ if (!pulse && IsBetween(duration, 750, 1000)) { RC6_Data.State = RemoteDetectionState.PreData; - RC6_Data.Bit -= 2; ignored = false; } break; @@ -1233,7 +1232,6 @@ else { RC6_Data.HalfBit = 1; - //RC6_Data.LongPulse = true; RC6_Data.LongSpace = true; RC6_Data.Bit = 0; RC6_Data.Toggle |= 1; @@ -1247,10 +1245,10 @@ { RC6_Data.Bit = 16; } - else if (RC6_Data.Header == PrefixRC6Foxtel) - { - RC6_Data.Bit = 20; - } + //else if (RC6_Data.Header == PrefixRC6Foxtel) + //{ + //RC6_Data.Bit = 20; + //} else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) { RC6_Data.Bit = 32; @@ -1378,9 +1376,10 @@ else RC6_Data.Toggle = 4; - if (RC6_Data.Header == PrefixRC6Foxtel) - protocolVariation = IrProtocol.RC6_Foxtel; - else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + //if (RC6_Data.Header == PrefixRC6Foxtel) + //protocolVariation = IrProtocol.RC6_Foxtel; + //else + if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) protocolVariation = IrProtocol.RC6A; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |