From: <an...@us...> - 2008-03-19 00:38:38
|
Revision: 1482 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1482&view=rev Author: and-81 Date: 2008-03-18 17:38:37 -0700 (Tue, 18 Mar 2008) Log Message: ----------- Modified Paths: -------------- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/IrCode.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/IrDecoder.cs trunk/plugins/IR Server Suite/Applications/IR File Tool/Pronto.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.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/IrCode.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrDecoder.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/FormMain.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -369,10 +369,16 @@ } byte[] fileData = new byte[file.Length]; - file.Read(fileData, 0, (int)file.Length); - _code = IrCode.FromByteArray(fileData); + IrCode newCode = IrCode.FromByteArray(fileData); + if (newCode == null) + { + MessageBox.Show(this, "Not a valid IR code file", "Bad file", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + _code = newCode; } _fileName = openFileDialog.FileName; @@ -394,6 +400,102 @@ } private void buttonAttemptDecode_Click(object sender, EventArgs e) { + /* + int[][] timingData = new int[][] + { + + new int[] { + +2800, -750, +550, -350, +550, -350, +500, -800, +550, -800, +1400, -800, +550, -350, +500, -400, +500, -400, +500, -350, +550, -350, +500, -400, +500, -400, +500, -350, +500, -400, +500, -8400, +900, -850, +500, -400, +500, -400, +450, -400, +500, -400, +500, -400, +950, -400, +450, -850, +950, -50800, + }, + + new int[] { + +2700, -850, +450, -400, +500, -400, +500, -850, +500, -850, +1350, -850, +500, -400, +450, -400, +500, -400, +500, -400, +500, -400, +450, -400, +500, -400, +500, -400, +500, -400, +450, -400, +950, -400, +500, -400, +450, -450, +450, -850, +500, -400, +450, -450, +450, -400, +500, -400, +900, -900, +450, -400, +500, -400, +4600, -31750, + }, + + // RC6A (RC6_24) // no, Replay + new int[] { + 3107, -887, 443, -443, 443, -443, 443, -887, 443, -887, 887, -443, 443, -443, 443, -443, 443, -443, 443, -443, 443, -443, 887, -443, 443, -887, 887, -443, 443, -443, 443, -443, 443, -443, 443, -887, 443, -443, 443, -443, 443, -443, 887, -443, 443, -443, 443, -887, 443, -443, 443, -443, 443, -75000 + }, + + // RC6_MCE + new int[] { + +2750, -800, +550, -350, +500, -350, +550, -800, +500, -800, +1450, // Header + -800, +500, -350, +550, -350, +500, -400, +500, -350, +550, -350, +500, -400, +500, -350, +500, -400, +500, -400, +500, -350, +950, -400, +500, -400, +500, -350, +500, -850, +500, -400, +450, -400, +500, -400, +500, -400, +900, -850, +500, -400, +500, -350, +500, -400, +500, -400, +500, -350, +950, -400, +500, -850, +900, -19050, + }, + // Nothing + new int[] { + +2800, -750, +550, -350, +550, -350, +500, -800, +550, -800, +1400, // Header + -800, +550, -350, +500, -400, +500, -400, +500, -350, +550, -350, +500, -400, +500, -400, +500, -350, +500, -400, +500, -8400, +900, -850, +500, -400, +500, -400, +450, -400, +500, -400, +500, -400, +950, -400, +450, -850, +950, -70000, + }, + // RC6_24 + new int[] { + +2700, -850, +450, -400, +500, -400, +500, -850, +500, -850, +1350, // Header + -850, +500, -400, +450, -400, +500, -400, +500, -400, +500, -400, +450, -400, +500, -400, +500, -400, +500, -400, +450, -400, +950, -400, +500, -400, +450, -450, +450, -850, +500, -400, +450, -450, +450, -400, +500, -400, +900, -900, +450, -400, +500, -400, +4600, -61750, + }, + + new int[] { + +2650, -900, +450, -400, +450, -450, +450, -900, +450, -850, +1350, // Header + -900, +450, -400, +500, -400, +450, -450, +450, -450, +450, -400, +500, -400, +450, -450, +450, -450, +450, -400, +500, -400, +900, -450, +450, -450, +450, -400, +450, -450, +5150, -31750, + }, + }; + + for (int index = 0; index < timingData.GetLength(0); index++) + { + IrDecoder.DecodeIR(timingData[index], new RemoteCallback(RemoteEvent), new KeyboardCallback(KeyboardEvent), new MouseCallback(MouseEvent)); + + IrCode newCode = new IrCode(timingData[index]); + Pronto.WriteProntoFile(String.Format("C:\\{0}.ir", index), Pronto.ConvertIrCodeToProntoRaw(newCode)); + + } + */ + /* + + byte[] data = new byte[] { + //0x11, 0x8A, 0x08, 0x08, 0x8A, 0x11, 0x11, 0x9B, 0x11, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x08, 0x08, 0x8B, 0x07, 0x08, 0x8A, 0x08, 0x09, 0x8A, 0x08, 0x09, 0x89, 0x12, 0x08, 0x8A, 0x08, 0x09, 0x89, 0x09, 0x12, 0x8A, 0x08, 0x08, 0x8A, 0x08, 0x08, 0x93, 0x08, 0x08, 0x8A, 0x08, 0x11, 0x89, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x5C + 0x11, 0x89, 0x08, 0x08, 0x8A, 0x11, 0x11, 0x9C, 0x11, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x09, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x08, 0x08, 0x8A, 0x09, 0x08, 0x8A, 0x09, 0x11, 0x8B, 0x08, 0x08, 0x8A, 0x08, 0x12, 0x8A, 0x08, 0x08, 0x8A, 0x09, 0x12, 0x8A, 0x08, 0x08, 0x92, 0x12, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x5C, + }; + + List<int> timingData = new List<int>(); + + int len = 0; + byte curByte; + int time; + + for (int j = 0; j < data.Length; j++) + { + curByte = data[j]; + + if ((curByte & 0x80) != 0) + len -= (int)(curByte & 0x7F); + else + len += (int)curByte; + + if ((curByte & 0x7F) != 0x7F) + { + time = len * 50; + + if (timingData.Count > 0 && ((timingData[timingData.Count - 1] > 0 && time > 0) || (timingData[timingData.Count - 1] < 0 && time < 0))) + timingData[timingData.Count - 1] += time; + else + timingData.Add(time); + + len = 0; + } + } + + if (len != 0) + { + time = len * 50; + + if ((timingData[timingData.Count - 1] > 0 && time > 0) || (timingData[timingData.Count - 1] < 0 && time < 0)) + timingData[timingData.Count - 1] += time; + else + timingData.Add(time); + } + + IrDecoder.DecodeIR(timingData.ToArray(), new RemoteCallback(RemoteEvent), new KeyboardCallback(KeyboardEvent), new MouseCallback(MouseEvent)); + */ + IrDecoder.DecodeIR(_code.TimingData, new RemoteCallback(RemoteEvent), new KeyboardCallback(KeyboardEvent), new MouseCallback(MouseEvent)); } @@ -446,37 +548,48 @@ void RemoteEvent(IrProtocol codeType, uint keyCode, bool firstPress) { - if (DialogResult.Yes == MessageBox.Show(this, String.Format("Remote: {0}, {1}\nUse this protocol's carrier frequency?", Enum.GetName(typeof(IrProtocol), codeType), keyCode), "Decode IR", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) + MessageBox.Show(this, String.Format("Protocol: {0}\nCode: {1}", Enum.GetName(typeof(IrProtocol), codeType), keyCode), "Decode IR", MessageBoxButtons.OK, MessageBoxIcon.Information); + + int newCarrier; + switch (codeType) { - switch (codeType) - { - case IrProtocol.Daewoo: textBoxCarrier.Text = "38000"; break; - case IrProtocol.JVC: textBoxCarrier.Text = "38000"; break; - case IrProtocol.Matsushita: textBoxCarrier.Text = "56800"; break; - case IrProtocol.Mitsubishi: textBoxCarrier.Text = "40000"; break; - case IrProtocol.NEC: textBoxCarrier.Text = "38000"; break; - case IrProtocol.NRC17: textBoxCarrier.Text = "38000"; break; - case IrProtocol.Panasonic: textBoxCarrier.Text = "38000"; break; - case IrProtocol.RC5: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RC5X: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RC6: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RC6A: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RC6_MCE: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RC6_Foxtel: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RCA: textBoxCarrier.Text = "56000"; break; - case IrProtocol.RCMM: textBoxCarrier.Text = "36000"; break; - case IrProtocol.RECS80: textBoxCarrier.Text = "38000"; break; - case IrProtocol.Sharp: textBoxCarrier.Text = "38000"; break; - case IrProtocol.SIRC: textBoxCarrier.Text = "40000"; break; - case IrProtocol.Toshiba: textBoxCarrier.Text = "38000"; break; - case IrProtocol.XSAT: textBoxCarrier.Text = "38000"; break; + case IrProtocol.Daewoo: newCarrier = 38000; break; + case IrProtocol.JVC: newCarrier = 38000; break; + case IrProtocol.Matsushita: newCarrier = 56800; break; + case IrProtocol.Mitsubishi: newCarrier = 40000; break; + case IrProtocol.NEC: newCarrier = 38000; break; + case IrProtocol.NRC17: newCarrier = 38000; break; + case IrProtocol.Panasonic: newCarrier = 38000; break; + case IrProtocol.RC5: newCarrier = 36000; break; + case IrProtocol.RC5X: newCarrier = 36000; break; + case IrProtocol.RC6: newCarrier = 36000; break; + case IrProtocol.RC6A: newCarrier = 36000; break; + case IrProtocol.RC6_MCE: newCarrier = 36000; break; + case IrProtocol.RC6_16: newCarrier = 36000; break; + case IrProtocol.RC6_20: newCarrier = 36000; break; + case IrProtocol.RC6_24: newCarrier = 36000; break; + case IrProtocol.RC6_32: newCarrier = 36000; break; + case IrProtocol.RCA: newCarrier = 56000; break; + case IrProtocol.RCMM: newCarrier = 36000; break; + case IrProtocol.RECS80: newCarrier = 38000; break; + case IrProtocol.Sharp: newCarrier = 38000; break; + case IrProtocol.SIRC: newCarrier = 40000; break; + case IrProtocol.Toshiba: newCarrier = 38000; break; + case IrProtocol.XSAT: newCarrier = 38000; break; - default: - return; - } + default: + return; + } - _code.Carrier = int.Parse(textBoxCarrier.Text); + if (_code.Carrier == newCarrier) + return; + if (DialogResult.Yes == MessageBox.Show(this, String.Format("Use this protocol's carrier frequency ({0})?", newCarrier), "Decode IR", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) + { + textBoxCarrier.Text = newCarrier.ToString(); + + _code.Carrier = newCarrier; + RefreshForm(); } } Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/IrCode.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/IrCode.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/IrCode.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -225,7 +225,8 @@ prontoData[i] = ushort.Parse(stringData[i], System.Globalization.NumberStyles.HexNumber); IrCode newCode = Pronto.ConvertProntoDataToIrCode(prontoData); - newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... + if (newCode != null) + newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... return newCode; } Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/IrDecoder.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/IrDecoder.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/IrDecoder.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -73,10 +73,22 @@ /// </summary> RC6_MCE, /// <summary> - /// Foxtel's protocol variation of Philips RC6. 36kHz carrier. + /// RC6-6-16 protocol variation of Philips RC6. 36kHz carrier. Used by some Vista MCE remotes (I think). /// </summary> - RC6_Foxtel, + RC6_16, /// <summary> + /// RC6-6-20 protocol variation of Philips RC6. 36kHz carrier. Used by Pace Foxtel STB's. + /// </summary> + RC6_20, + /// <summary> + /// RC6-6-24 protocol variation of Philips RC6. 36kHz carrier. RC6A. + /// </summary> + RC6_24, + /// <summary> + /// RC6-6-32 protocol variation of Philips RC6. 36kHz carrier. Used by Microsoft MCE remote. + /// </summary> + RC6_32, + /// <summary> /// RCA protocol. 56kHz carrier. /// </summary> RCA, @@ -134,16 +146,16 @@ const ushort CustomerMce = 0x800F; const ushort ToggleBitRC5 = 0x0800; - const ushort ToggleMaskRC5 = 0xF7FF; + const ushort ToggleMaskRC5 = 0x07FF; const uint ToggleBitRC5X = 0x00020000; - const ushort ToggleMaskRC5X = 0xFFFF; + const uint ToggleMaskRC5X = 0x0001FFFF; const uint RC6HeaderMask = 0xFFFFFFF0; - const uint PrefixRC6 = 0x000FC950; - const uint PrefixRC6A = 0x000FCA90; - const uint PrefixRC6Foxtel = 0x000FCA93; + //const uint PrefixRC6 = 0x000FC950; + //const uint PrefixRC6A = 0x000FCA90; + //const uint PrefixRC6M2X = 0x000FCA93; const uint MceMouse = 1; const uint MceKeyboard = 4; @@ -998,7 +1010,7 @@ case RemoteDetectionState.HeaderPulse: if (pulse) { - if (IsBetween(duration, 750, 1100)) + if (IsBetween(duration, 700, 1100)) { RC5_Data.State = RemoteDetectionState.HeaderSpace; RC5_Data.Bit = 13; @@ -1019,7 +1031,7 @@ #region HeaderSpace case RemoteDetectionState.HeaderSpace: - if (!pulse && IsBetween(duration, 750, 1000)) + if (!pulse && IsBetween(duration, 700, 1100)) { RC5_Data.State = RemoteDetectionState.Data; RC5_Data.HalfBit = 0; @@ -1034,7 +1046,7 @@ { if (pulse) { - if (IsBetween(duration, 750, 1100) || IsBetween(duration, 1500, 2000)) + if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000)) { RC5_Data.HalfBit = (byte)((duration >= 1500) ? 0 : 1); RC5_Data.Bit--; @@ -1047,7 +1059,7 @@ } else { - if (IsBetween(duration, 750, 1100) || IsBetween(duration, 1500, 2000)) + if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000)) { RC5_Data.HalfBit = (byte)((duration >= 1500) ? 0 : 1); RC5_Data.Bit--; @@ -1064,41 +1076,29 @@ RC5_Data.Bit += 5; } } - break; } - - if (IsBetween(duration, 750, 1100)) + else // RC5_Data.HalfBit != 0 { - RC5_Data.HalfBit = 0; - ignored = false; + if (IsBetween(duration, 700, 1100)) + { + RC5_Data.HalfBit = 0; + ignored = false; - if ((RC5_Data.Bit == 1) && pulse) - RC5_Data.State = RemoteDetectionState.KeyCode; + if ((RC5_Data.Bit == 1) && pulse) + RC5_Data.State = RemoteDetectionState.KeyCode; + } + else if (RC5_Data.Bit == 7 && (IsBetween(duration, 3400, 3800) || IsBetween(duration, 4300, 4700))) + { + RC5_Data.HalfBit = (byte)((duration >= 4300) ? 0 : 1); + RC5_Data.Code <<= 6; + RC5_Data.Bit += 6; + ignored = false; + } } - else if (RC5_Data.Bit == 7 && (IsBetween(duration, 3400, 3800) || IsBetween(duration, 4300, 4700))) - { - RC5_Data.HalfBit = (byte)((duration >= 4300) ? 0 : 1); - RC5_Data.Code <<= 6; - RC5_Data.Bit += 6; - ignored = false; - } break; #endregion Data - #region Leading - case RemoteDetectionState.Leading: - if (pulse) - break; - - if (duration > 10000) - { - RC5_Data.State = RemoteDetectionState.HeaderPulse; - ignored = false; - } - break; - #endregion Leading - } if (RC5_Data.State == RemoteDetectionState.KeyCode) @@ -1156,14 +1156,14 @@ case RemoteDetectionState.HeaderPulse: if (pulse && IsBetween(duration, 2600, 3300)) { - RC6_Data.State = RemoteDetectionState.HeaderSpace; - RC6_Data.Header = 0x000FC000; - RC6_Data.Bit = 12; - RC6_Data.HalfBit = 0; - RC6_Data.Code = 0; - RC6_Data.LongPulse = false; - RC6_Data.LongSpace = false; - RC6_Data.Toggle &= 0xFE; + RC6_Data.State = RemoteDetectionState.HeaderSpace; + RC6_Data.Header = 0x000FC000; + RC6_Data.Bit = 12; + RC6_Data.HalfBit = 0; + RC6_Data.Code = 0; + RC6_Data.LongPulse = false; + RC6_Data.LongSpace = false; + RC6_Data.Toggle &= 0xFE; ignored = false; } break; @@ -1240,27 +1240,8 @@ } if (!ignored && RC6_Data.Bit == 0) - { - if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6) - { - RC6_Data.Bit = 16; - } - //else if (RC6_Data.Header == PrefixRC6Foxtel) - //{ - //RC6_Data.Bit = 20; - //} - else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) - { - RC6_Data.Bit = 32; - } - else - { - ignored = true; - break; - } + RC6_Data.State = RemoteDetectionState.Data; - RC6_Data.State = RemoteDetectionState.Data; - } break; #endregion PreData @@ -1274,8 +1255,8 @@ RC6_Data.LongPulse = true; RC6_Data.HalfBit++; - if (RC6_Data.Bit == 1) - RC6_Data.State = RemoteDetectionState.KeyCode; + //if (RC6_Data.Bit == 1) + //RC6_Data.State = RemoteDetectionState.KeyCode; } else if (!pulse && IsBetween(duration, 300, 600)) { @@ -1283,6 +1264,12 @@ RC6_Data.LongSpace = true; RC6_Data.HalfBit++; } + else if (!pulse && duration > 4000) + { + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) + RC6_Data.State = RemoteDetectionState.KeyCode; + } + break; } @@ -1294,17 +1281,29 @@ if (IsBetween(duration, 750, 1000)) { - RC6_Data.Bit--; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.LongSpace = true; RC6_Data.HalfBit += 2; ignored = false; } else if (IsBetween(duration, 300, 600)) { - RC6_Data.Bit--; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.HalfBit++; ignored = false; } + else if (duration > 4000) + { + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) + RC6_Data.State = RemoteDetectionState.KeyCode; + } } else if (RC6_Data.LongSpace) { @@ -1313,28 +1312,38 @@ if (!pulse) break; - if (RC6_Data.Bit == 32) - RC6_Data.Bit = 24; + //if (RC6_Data.Bit == 32) + //RC6_Data.Bit = 24; if (IsBetween(duration, 750, 1000)) { - RC6_Data.Bit--; - RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.Code |= 1; + //RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.LongPulse = true; RC6_Data.HalfBit += 2; ignored = false; - if (RC6_Data.Bit == 1) - RC6_Data.State = RemoteDetectionState.KeyCode; + //if (RC6_Data.Bit == 1) + //RC6_Data.State = RemoteDetectionState.KeyCode; } else if (IsBetween(duration, 300, 600)) { - RC6_Data.Bit--; - RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.Code |= 1; + RC6_Data.HalfBit++; ignored = false; - if (RC6_Data.Bit == 0) + //if (RC6_Data.Bit == 0) + //RC6_Data.State = RemoteDetectionState.KeyCode; + } + else if (duration > 4000) + { + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) RC6_Data.State = RemoteDetectionState.KeyCode; } } @@ -1363,7 +1372,7 @@ protocolVariation = IrProtocol.RC6_MCE; } - else // Standard RC6 or Non-MCE variations + else // Non-MCE RC6 variations { bool toggleOn = (RC6_Data.Toggle & 1) == 1; @@ -1376,11 +1385,36 @@ else RC6_Data.Toggle = 4; - //if (RC6_Data.Header == PrefixRC6Foxtel) - //protocolVariation = IrProtocol.RC6_Foxtel; - //else - if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + if (RC6_Data.Bit == 16) + protocolVariation = IrProtocol.RC6_16; + else if (RC6_Data.Bit == 20) + protocolVariation = IrProtocol.RC6_20; + else if (RC6_Data.Bit == 24) + protocolVariation = IrProtocol.RC6_24; + else if (RC6_Data.Bit == 32) + protocolVariation = IrProtocol.RC6_32; + else + break; + + /* + if (RC6_Data.Header == PrefixRC6M2X) + { + if (RC6_Data.Bit == 16) + protocolVariation = IrProtocol.RC6_16; + else if (RC6_Data.Bit == 20) + protocolVariation = IrProtocol.RC6_20; + else if (RC6_Data.Bit == 24) + protocolVariation = IrProtocol.RC6_24; + else if (RC6_Data.Bit == 32) + protocolVariation = IrProtocol.RC6_32; + else + break; + } + else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + { protocolVariation = IrProtocol.RC6A; + } + */ } remoteCallback(protocolVariation, RC6_Data.Code, first); Modified: trunk/plugins/IR Server Suite/Applications/IR File Tool/Pronto.cs =================================================================== --- trunk/plugins/IR Server Suite/Applications/IR File Tool/Pronto.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Applications/IR File Tool/Pronto.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -250,20 +250,20 @@ for (int i = 13; i > 0; i--) { - if ((rc5 & (1 << i)) != 0) // Logic 1 (S, P) + if ((rc5 & (1 << i)) != 0) // Logic 1 (Space, Pulse) { if (currentTime > 0) { timingData.Add(currentTime); currentTime = 0; } - + currentTime -= 900; timingData.Add(currentTime); - + currentTime = 900; } - else // Logic 0 (P, S) + else // Logic 0 (Pulse, Space) { if (currentTime < 0) { Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Common.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -501,8 +501,16 @@ process.Start(); // Give new process focus ... - if (!process.StartInfo.CreateNoWindow && process.StartInfo.WindowStyle != ProcessWindowStyle.Hidden && forceFocus) + if (forceFocus && !process.StartInfo.CreateNoWindow && process.StartInfo.WindowStyle != ProcessWindowStyle.Hidden) { + process.WaitForInputIdle(5000); + + Thread focusForcer = new Thread(new ParameterizedThreadStart(FocusForcer)); + focusForcer.Name = String.Format("Focus Forcer: {0}", process.MainWindowTitle); + focusForcer.IsBackground = true; + focusForcer.Start(process.MainWindowTitle); + + /* int attempt = 0; while (!process.HasExited && attempt++ < 50) { @@ -514,6 +522,7 @@ Thread.Sleep(500); } + */ } if (waitForExit) @@ -521,6 +530,33 @@ } } + static void FocusForcer(object processObj) + { + string title = processObj as string; + + if (title == null) + throw new ArgumentException("Argument is not a string object", "processObj"); + + IntPtr windowHandle; + + while ((windowHandle = Win32.FindWindowByTitle(title)) != IntPtr.Zero) + { + IntPtr focused = Win32.ForegroundWindow(); + + string focusedTitle = Win32.GetWindowTitle(focused); + + Trace.WriteLine(String.Format("Focused: {0}", focused.ToInt32())); + + if (!title.Equals(focusedTitle, StringComparison.Ordinal) && !Win32.IsWindowChild(windowHandle, focused) && Win32.GetParentWindow(focused) != windowHandle) + { + Win32.SetForegroundWindow(windowHandle, true); + Trace.WriteLine(String.Format("Give focus to {0}", windowHandle.ToInt32())); + } + + Thread.Sleep(1500); + } + } + /// <summary> /// Given a split Serial Command this method will send the command over the serial port according to the command structure supplied. /// </summary> Modified: trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs =================================================================== --- trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/Common/IrssUtils/Win32.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -1907,11 +1907,41 @@ StringBuilder lpClassName, int nMaxCount); + [DllImport("user32.dll")] + static extern bool IsChild( + IntPtr hWndParent, + IntPtr hWndChild); + + [DllImport("user32.dll")] + static extern IntPtr GetParent( + IntPtr hWnd); + #endregion Interop #region Methods /// <summary> + /// Gets the parent window. + /// </summary> + /// <param name="child">The child.</param> + /// <returns>Handle to parent window.</returns> + public static IntPtr GetParentWindow(IntPtr child) + { + return GetParent(child); + } + + /// <summary> + /// Determines whether one window is a child of another. + /// </summary> + /// <param name="parent">The parent.</param> + /// <param name="child">The child.</param> + /// <returns><c>true</c> if the window is a child of the parent; otherwise, <c>false</c>.</returns> + public static bool IsWindowChild(IntPtr parent, IntPtr child) + { + return IsChild(parent, child); + } + + /// <summary> /// Gets the desktop window handle. /// </summary> /// <returns></returns> 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-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverReplacement.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -53,7 +53,7 @@ /// </summary> Microsoft = 0, /// <summary> - /// Device is an third party SMK or Topseed MCE transceiver. + /// Device is a third party SMK or Topseed MCE transceiver. /// </summary> SmkTopseed = 1, } @@ -212,6 +212,9 @@ try { + if (_readHandle == null) + throw new InvalidOperationException("Cannot stop, device is not active"); + _notifyWindow.DeviceArrival -= new DeviceEventHandler(OnDeviceArrival); _notifyWindow.DeviceRemoval -= new DeviceEventHandler(OnDeviceRemoval); @@ -223,12 +226,14 @@ catch (Exception ex) { DebugWriteLine(ex.ToString()); + throw; + } #else catch { -#endif throw; } +#endif finally { _notifyWindow.Dispose(); @@ -249,10 +254,28 @@ DebugWriteLine("Suspend()"); #endif - WriteSync(StopPacket); + try + { + if (_readHandle == null) + throw new InvalidOperationException("Cannot suspend, device is not active"); - StopReadThread(); - CloseDevice(); + WriteSync(StopPacket); + + StopReadThread(); + CloseDevice(); + } +#if DEBUG + catch (Exception ex) + { + DebugWriteLine(ex.ToString()); + throw; + } +#else + catch + { + throw; + } +#endif } /// <summary> @@ -267,13 +290,11 @@ try { if (String.IsNullOrEmpty(Driver.Find(_deviceGuid))) - { -#if DEBUG - DebugWriteLine("Device not available"); -#endif - return; - } + throw new InvalidOperationException("Device not available"); + if (_readHandle != null) + throw new InvalidOperationException("Cannot resume, device is active"); + OpenDevice(); StartReadThread(); InitializeDevice(); @@ -282,6 +303,7 @@ catch (Exception ex) { DebugWriteLine(ex.ToString()); + throw; } #else catch @@ -392,6 +414,7 @@ /// </summary> void InitializeDevice() { + 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?) @@ -749,8 +772,10 @@ if (!success) throw new InvalidOperationException("Failed to initialize safe wait handle"); + IntPtr dangerousWaitHandle = safeWaitHandle.DangerousGetHandle(); + DeviceIoOverlapped overlapped = new DeviceIoOverlapped(); - overlapped.ClearAndSetEvent(safeWaitHandle.DangerousGetHandle()); + overlapped.ClearAndSetEvent(dangerousWaitHandle); deviceBufferPtr = Marshal.AllocHGlobal(DeviceBufferSize); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverVista.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -523,14 +523,23 @@ if (!_deviceAvailable) throw new InvalidOperationException("Device not available"); - try + int lastError; + + using (WaitHandle waitHandle = new ManualResetEvent(false)) { - int lastError; + SafeHandle safeWaitHandle = waitHandle.SafeWaitHandle; - using (WaitHandle waitHandle = new ManualResetEvent(false)) + bool success = false; + safeWaitHandle.DangerousAddRef(ref success); + if (!success) + throw new InvalidOperationException("Failed to initialize safe wait handle"); + + try { + IntPtr dangerousWaitHandle = safeWaitHandle.DangerousGetHandle(); + DeviceIoOverlapped overlapped = new DeviceIoOverlapped(); - overlapped.ClearAndSetEvent(waitHandle.SafeWaitHandle.DangerousGetHandle()); + overlapped.ClearAndSetEvent(dangerousWaitHandle); bool deviceIoControl = DeviceIoControl(_eHomeHandle, ioControlCode, inBuffer, inBufferSize, outBuffer, outBufferSize, out bytesReturned, overlapped.Overlapped); lastError = Marshal.GetLastWin32Error(); @@ -549,13 +558,17 @@ throw new Win32Exception(lastError); } } - } - catch - { - if (_eHomeHandle != null) - CancelIo(_eHomeHandle); + catch + { + if (_eHomeHandle != null) + CancelIo(_eHomeHandle); - throw; + throw; + } + finally + { + safeWaitHandle.DangerousRelease(); + } } } 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-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/DriverXP.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -53,7 +53,7 @@ /// </summary> Microsoft = 0, /// <summary> - /// Device is an third party SMK or Topseed MCE transceiver. + /// Device is a third party SMK or Topseed MCE transceiver. /// </summary> SmkTopseed = 1, } @@ -211,6 +211,9 @@ try { + if (_eHomeHandle == null) + throw new InvalidOperationException("Cannot stop, device is not active"); + _notifyWindow.DeviceArrival -= new DeviceEventHandler(OnDeviceArrival); _notifyWindow.DeviceRemoval -= new DeviceEventHandler(OnDeviceRemoval); @@ -222,12 +225,14 @@ catch (Exception ex) { DebugWriteLine(ex.ToString()); + throw; + } #else catch { -#endif throw; } +#endif finally { _notifyWindow.Dispose(); @@ -248,10 +253,28 @@ DebugWriteLine("Suspend()"); #endif - WriteSync(StopPacket); + try + { + if (_eHomeHandle == null) + throw new InvalidOperationException("Cannot suspend, device is not active"); - StopReadThread(); - CloseDevice(); + WriteSync(StopPacket); + + StopReadThread(); + CloseDevice(); + } +#if DEBUG + catch (Exception ex) + { + DebugWriteLine(ex.ToString()); + throw; + } +#else + catch + { + throw; + } +#endif } /// <summary> @@ -266,13 +289,11 @@ try { if (String.IsNullOrEmpty(Driver.Find(_deviceGuid))) - { -#if DEBUG - DebugWriteLine("Device not available"); -#endif - return; - } + throw new InvalidOperationException("Device not available"); + if (_eHomeHandle != null) + throw new InvalidOperationException("Cannot resume, device is active"); + OpenDevice(); StartReadThread(); InitializeDevice(); @@ -281,6 +302,7 @@ catch (Exception ex) { DebugWriteLine(ex.ToString()); + throw; } #else catch @@ -391,6 +413,7 @@ /// </summary> void InitializeDevice() { + 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?) @@ -727,8 +750,10 @@ if (!success) throw new InvalidOperationException("Failed to initialize safe wait handle"); + IntPtr dangerousWaitHandle = safeWaitHandle.DangerousGetHandle(); + DeviceIoOverlapped overlapped = new DeviceIoOverlapped(); - overlapped.ClearAndSetEvent(safeWaitHandle.DangerousGetHandle()); + overlapped.ClearAndSetEvent(dangerousWaitHandle); deviceBufferPtr = Marshal.AllocHGlobal(DeviceBufferSize); Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrCode.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -225,7 +225,8 @@ prontoData[i] = ushort.Parse(stringData[i], System.Globalization.NumberStyles.HexNumber); IrCode newCode = Pronto.ConvertProntoDataToIrCode(prontoData); - newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... + if (newCode != null) + newCode.FinalizeData(); // Seems some old files have excessively long delays in them .. this might fix that problem ... return newCode; } 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 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/IrDecoder.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -73,10 +73,22 @@ /// </summary> RC6_MCE, /// <summary> - /// Foxtel's protocol variation of Philips RC6. 36kHz carrier. + /// RC6-6-16 protocol variation of Philips RC6. 36kHz carrier. Used by some Vista MCE remotes (I think). /// </summary> - RC6_Foxtel, + RC6_16, /// <summary> + /// RC6-6-20 protocol variation of Philips RC6. 36kHz carrier. Used by Pace Foxtel STB's. + /// </summary> + RC6_20, + /// <summary> + /// RC6-6-24 protocol variation of Philips RC6. 36kHz carrier. RC6A. + /// </summary> + RC6_24, + /// <summary> + /// RC6-6-32 protocol variation of Philips RC6. 36kHz carrier. Used by Microsoft MCE remote. + /// </summary> + RC6_32, + /// <summary> /// RCA protocol. 56kHz carrier. /// </summary> RCA, @@ -134,16 +146,16 @@ const ushort CustomerMce = 0x800F; const ushort ToggleBitRC5 = 0x0800; - const ushort ToggleMaskRC5 = 0xF7FF; + const ushort ToggleMaskRC5 = 0x07FF; const uint ToggleBitRC5X = 0x00020000; - const ushort ToggleMaskRC5X = 0xFFFF; + const uint ToggleMaskRC5X = 0x0001FFFF; const uint RC6HeaderMask = 0xFFFFFFF0; - const uint PrefixRC6 = 0x000FC950; - const uint PrefixRC6A = 0x000FCA90; - const uint PrefixRC6Foxtel = 0x000FCA93; + //const uint PrefixRC6 = 0x000FC950; + //const uint PrefixRC6A = 0x000FCA90; + //const uint PrefixRC6M2X = 0x000FCA93; const uint MceMouse = 1; const uint MceKeyboard = 4; @@ -998,7 +1010,7 @@ case RemoteDetectionState.HeaderPulse: if (pulse) { - if (IsBetween(duration, 750, 1100)) + if (IsBetween(duration, 700, 1100)) { RC5_Data.State = RemoteDetectionState.HeaderSpace; RC5_Data.Bit = 13; @@ -1019,7 +1031,7 @@ #region HeaderSpace case RemoteDetectionState.HeaderSpace: - if (!pulse && IsBetween(duration, 750, 1000)) + if (!pulse && IsBetween(duration, 700, 1100)) { RC5_Data.State = RemoteDetectionState.Data; RC5_Data.HalfBit = 0; @@ -1034,7 +1046,7 @@ { if (pulse) { - if (IsBetween(duration, 750, 1100) || IsBetween(duration, 1500, 2000)) + if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000)) { RC5_Data.HalfBit = (byte)((duration >= 1500) ? 0 : 1); RC5_Data.Bit--; @@ -1047,7 +1059,7 @@ } else { - if (IsBetween(duration, 750, 1100) || IsBetween(duration, 1500, 2000)) + if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000)) { RC5_Data.HalfBit = (byte)((duration >= 1500) ? 0 : 1); RC5_Data.Bit--; @@ -1064,41 +1076,29 @@ RC5_Data.Bit += 5; } } - break; } - - if (IsBetween(duration, 750, 1100)) + else // RC5_Data.HalfBit != 0 { - RC5_Data.HalfBit = 0; - ignored = false; + if (IsBetween(duration, 700, 1100)) + { + RC5_Data.HalfBit = 0; + ignored = false; - if ((RC5_Data.Bit == 1) && pulse) - RC5_Data.State = RemoteDetectionState.KeyCode; + if ((RC5_Data.Bit == 1) && pulse) + RC5_Data.State = RemoteDetectionState.KeyCode; + } + else if (RC5_Data.Bit == 7 && (IsBetween(duration, 3400, 3800) || IsBetween(duration, 4300, 4700))) + { + RC5_Data.HalfBit = (byte)((duration >= 4300) ? 0 : 1); + RC5_Data.Code <<= 6; + RC5_Data.Bit += 6; + ignored = false; + } } - else if (RC5_Data.Bit == 7 && (IsBetween(duration, 3400, 3800) || IsBetween(duration, 4300, 4700))) - { - RC5_Data.HalfBit = (byte)((duration >= 4300) ? 0 : 1); - RC5_Data.Code <<= 6; - RC5_Data.Bit += 6; - ignored = false; - } break; #endregion Data - #region Leading - case RemoteDetectionState.Leading: - if (pulse) - break; - - if (duration > 10000) - { - RC5_Data.State = RemoteDetectionState.HeaderPulse; - ignored = false; - } - break; - #endregion Leading - } if (RC5_Data.State == RemoteDetectionState.KeyCode) @@ -1156,14 +1156,14 @@ case RemoteDetectionState.HeaderPulse: if (pulse && IsBetween(duration, 2600, 3300)) { - RC6_Data.State = RemoteDetectionState.HeaderSpace; - RC6_Data.Header = 0x000FC000; - RC6_Data.Bit = 12; - RC6_Data.HalfBit = 0; - RC6_Data.Code = 0; - RC6_Data.LongPulse = false; - RC6_Data.LongSpace = false; - RC6_Data.Toggle &= 0xFE; + RC6_Data.State = RemoteDetectionState.HeaderSpace; + RC6_Data.Header = 0x000FC000; + RC6_Data.Bit = 12; + RC6_Data.HalfBit = 0; + RC6_Data.Code = 0; + RC6_Data.LongPulse = false; + RC6_Data.LongSpace = false; + RC6_Data.Toggle &= 0xFE; ignored = false; } break; @@ -1240,27 +1240,8 @@ } if (!ignored && RC6_Data.Bit == 0) - { - if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6) - { - RC6_Data.Bit = 16; - } - //else if (RC6_Data.Header == PrefixRC6Foxtel) - //{ - //RC6_Data.Bit = 20; - //} - else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) - { - RC6_Data.Bit = 32; - } - else - { - ignored = true; - break; - } + RC6_Data.State = RemoteDetectionState.Data; - RC6_Data.State = RemoteDetectionState.Data; - } break; #endregion PreData @@ -1274,8 +1255,8 @@ RC6_Data.LongPulse = true; RC6_Data.HalfBit++; - if (RC6_Data.Bit == 1) - RC6_Data.State = RemoteDetectionState.KeyCode; + //if (RC6_Data.Bit == 1) + //RC6_Data.State = RemoteDetectionState.KeyCode; } else if (!pulse && IsBetween(duration, 300, 600)) { @@ -1283,6 +1264,12 @@ RC6_Data.LongSpace = true; RC6_Data.HalfBit++; } + else if (!pulse && duration > 4000) + { + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) + RC6_Data.State = RemoteDetectionState.KeyCode; + } + break; } @@ -1294,17 +1281,29 @@ if (IsBetween(duration, 750, 1000)) { - RC6_Data.Bit--; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.LongSpace = true; RC6_Data.HalfBit += 2; ignored = false; } else if (IsBetween(duration, 300, 600)) { - RC6_Data.Bit--; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.HalfBit++; ignored = false; } + else if (duration > 4000) + { + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) + RC6_Data.State = RemoteDetectionState.KeyCode; + } } else if (RC6_Data.LongSpace) { @@ -1313,28 +1312,38 @@ if (!pulse) break; - if (RC6_Data.Bit == 32) - RC6_Data.Bit = 24; + //if (RC6_Data.Bit == 32) + //RC6_Data.Bit = 24; if (IsBetween(duration, 750, 1000)) { - RC6_Data.Bit--; - RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.Code |= 1; + //RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.LongPulse = true; RC6_Data.HalfBit += 2; ignored = false; - if (RC6_Data.Bit == 1) - RC6_Data.State = RemoteDetectionState.KeyCode; + //if (RC6_Data.Bit == 1) + //RC6_Data.State = RemoteDetectionState.KeyCode; } else if (IsBetween(duration, 300, 600)) { - RC6_Data.Bit--; - RC6_Data.Code |= (uint)1 << RC6_Data.Bit; + RC6_Data.Bit++; + RC6_Data.Code = RC6_Data.Code << 1; + RC6_Data.Code |= 1; + RC6_Data.HalfBit++; ignored = false; - if (RC6_Data.Bit == 0) + //if (RC6_Data.Bit == 0) + //RC6_Data.State = RemoteDetectionState.KeyCode; + } + else if (duration > 4000) + { + if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32) RC6_Data.State = RemoteDetectionState.KeyCode; } } @@ -1363,7 +1372,7 @@ protocolVariation = IrProtocol.RC6_MCE; } - else // Standard RC6 or Non-MCE variations + else // Non-MCE RC6 variations { bool toggleOn = (RC6_Data.Toggle & 1) == 1; @@ -1376,11 +1385,36 @@ else RC6_Data.Toggle = 4; - //if (RC6_Data.Header == PrefixRC6Foxtel) - //protocolVariation = IrProtocol.RC6_Foxtel; - //else - if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + if (RC6_Data.Bit == 16) + protocolVariation = IrProtocol.RC6_16; + else if (RC6_Data.Bit == 20) + protocolVariation = IrProtocol.RC6_20; + else if (RC6_Data.Bit == 24) + protocolVariation = IrProtocol.RC6_24; + else if (RC6_Data.Bit == 32) + protocolVariation = IrProtocol.RC6_32; + else + break; + + /* + if (RC6_Data.Header == PrefixRC6M2X) + { + if (RC6_Data.Bit == 16) + protocolVariation = IrProtocol.RC6_16; + else if (RC6_Data.Bit == 20) + protocolVariation = IrProtocol.RC6_20; + else if (RC6_Data.Bit == 24) + protocolVariation = IrProtocol.RC6_24; + else if (RC6_Data.Bit == 32) + protocolVariation = IrProtocol.RC6_32; + else + break; + } + else if ((RC6_Data.Header & RC6HeaderMask) == PrefixRC6A) + { protocolVariation = IrProtocol.RC6A; + } + */ } remoteCallback(protocolVariation, RC6_Data.Code, first); 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-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/MicrosoftMceTransceiver.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -300,8 +300,14 @@ if (_driver != null) { - _driver.Stop(); - _driver = null; + try + { + _driver.Stop(); + } + finally + { + _driver = null; + } } } Modified: trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs =================================================================== --- trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2008-03-17 16:46:10 UTC (rev 1481) +++ trunk/plugins/IR Server Suite/IR Server Plugins/Microsoft MCE Transceiver/Pronto.cs 2008-03-19 00:38:37 UTC (rev 1482) @@ -252,20 +252,20 @@ for (int i = 13; i > 0; i--) { - if ((rc5 & (1 << i)) != 0) // Logic 1 (S, P) + if ((rc5 & (1 << i)) != 0) // Logic 1 (Space, Pulse) { if (currentTime > 0) { timingData.Add(currentTime); currentTime = 0; } - + currentTime -= 900; timingData.Add(currentTime); - + currentTime = 900; } - else // Logic 0 (P, S) + else // Logic 0 (Pulse, Space) { if (currentTime < 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |