From 91c58e822d935371c131afdb1ba17986db089572 Mon Sep 17 00:00:00 2001 From: Generoso Martello Date: Mon, 10 Dec 2018 00:23:27 +0100 Subject: [PATCH] added support for CM19 Transceiver --- .../MIG.HomeAutomation.Tests.csproj | 105 ++-- MIG.HomeAutomation.Tests/packages.config | 2 +- MIG.HomeAutomation/MIG.HomeAutomation.csproj | 6 +- MIG.HomeAutomation/X10.cs | 491 ++++++++++++++---- MIG.HomeAutomation/packages.config | 3 +- README.md | 5 +- 6 files changed, 464 insertions(+), 148 deletions(-) diff --git a/MIG.HomeAutomation.Tests/MIG.HomeAutomation.Tests.csproj b/MIG.HomeAutomation.Tests/MIG.HomeAutomation.Tests.csproj index 20e56ad..4a445ec 100644 --- a/MIG.HomeAutomation.Tests/MIG.HomeAutomation.Tests.csproj +++ b/MIG.HomeAutomation.Tests/MIG.HomeAutomation.Tests.csproj @@ -1,58 +1,67 @@  - + + + + Debug + AnyCPU + {D5F0C9C4-CB64-4259-B590-84B30728C23E} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + MIG.HomeAutomation.Tests + MIG.HomeAutomation.Tests + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll + True + + + + + + + + + + + + + + + - Debug - AnyCPU - {D5F0C9C4-CB64-4259-B590-84B30728C23E} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library - Properties - MIG.HomeAutomation.Tests - MIG.HomeAutomation.Tests - v4.5 - 512 + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - ..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll - - - - - - - - - - + \ No newline at end of file diff --git a/MIG.HomeAutomation.Tests/packages.config b/MIG.HomeAutomation.Tests/packages.config index c108d44..391f728 100644 --- a/MIG.HomeAutomation.Tests/packages.config +++ b/MIG.HomeAutomation.Tests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/MIG.HomeAutomation/MIG.HomeAutomation.csproj b/MIG.HomeAutomation/MIG.HomeAutomation.csproj index f00dd86..7be138e 100644 --- a/MIG.HomeAutomation/MIG.HomeAutomation.csproj +++ b/MIG.HomeAutomation/MIG.HomeAutomation.csproj @@ -31,6 +31,10 @@ false + + ..\packages\CM19Lib.1.0.3\lib\CM19Lib.dll + True + ..\packages\CommonMark.NET.0.15.1\lib\net45\CommonMark.dll True @@ -85,7 +89,7 @@ True - ..\packages\XTenLib.1.0.10\lib\XTenLib.dll + ..\packages\XTenLib.1.0.11\lib\XTenLib.dll True diff --git a/MIG.HomeAutomation/X10.cs b/MIG.HomeAutomation/X10.cs index 68a529e..1957d30 100644 --- a/MIG.HomeAutomation/X10.cs +++ b/MIG.HomeAutomation/X10.cs @@ -24,13 +24,19 @@ limitations under the License. using System; using System.IO; using System.Collections.Generic; +using System.Globalization; using System.Threading; using MIG.Interfaces.HomeAutomation.Commons; using MIG.Config; +using CM19Lib; +using CM19Lib.X10; + using XTenLib; +using RfCommandReceivedEventArgs = CM19Lib.Events.RfCommandReceivedEventArgs; + namespace MIG.Interfaces.HomeAutomation { public class X10 : MigInterface @@ -51,17 +57,24 @@ public enum Commands Control_Level_Adjust, Control_Toggle, Control_AllLightsOn, - Control_AllLightsOff + Control_AllUnitsOff } #endregion #region Private fields - private XTenManager x10lib; + private const string Cm19LibDriverPort = "CM19-USB"; + private const string Cm15LibDriverPort = "USB"; + private readonly Cm19Manager cm19Lib; + private readonly XTenManager x10Lib; private Timer rfPulseTimer; + private int RfPulseDelay = 300; private List securityModules; private List