diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 23b077a4..7fe106d3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -79,7 +79,7 @@ jobs: # contains(steps.setVersion.outputs.version, '-beta-') uses: ncipollo/release-action@v1 with: - artifacts: 'output\*.*(cpz|cplz)' + artifacts: 'output\**\*.*(cpz|cplz)' generateReleaseNotes: true prerelease: ${{contains('debug', env.BUILD_TYPE)}} tag: ${{ steps.setVersion.outputs.version }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 608fc7b5..babd2651 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: uses: ncipollo/release-action@v1 with: updateRelease: true - artifacts: 'output\*.*(cpz|cplz)' + artifacts: 'output\**\*.*(cpz|cplz)' tag: ${{ steps.setVersion.outputs.version }} - name: Setup Nuget run: | diff --git a/PepperDash.Essentials.sln b/PepperDash.Essentials.sln index 40da3b9b..e2db852a 100644 --- a/PepperDash.Essentials.sln +++ b/PepperDash.Essentials.sln @@ -11,18 +11,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PepperDash.Essentials.Core" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug 4.7.2|Any CPU = Debug 4.7.2|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Debug|Any CPU.Build.0 = Debug|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.ActiveCfg = Release|Any CPU {53E204B7-97DD-441D-A96C-721DF014DF82}.Release|Any CPU.Build.0 = Release|Any CPU + {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB3B11BA-625C-4D35-B663-FDC5BE9A230E}.Release|Any CPU.Build.0 = Release|Any CPU + {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.ActiveCfg = Debug 4.7.2|Any CPU + {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug 4.7.2|Any CPU.Build.0 = Debug 4.7.2|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3D192FED-8FFC-4CB5-B5F7-BA307ABA254B}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index 807679e4..83bbc930 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,28 +1,26 @@ - + true - content; + build; - + true - content; + build; - - - - + + + + + - - - - + - - - - - + + + + + diff --git a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs index 0800f79f..68859760 100644 --- a/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs +++ b/src/PepperDash.Essentials.Core/Bridges/BridgeBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.EthernetCommunication; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs deleted file mode 100644 index 7959a511..00000000 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/DigitalLoggerJoinMap.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -namespace PepperDash.Essentials.Core.Bridges -{ - [Obsolete("This Device will be moved to a plugin in a future update")] - public class DigitalLoggerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint CircuitNames { get; set; } - public uint CircuitState { get; set; } - public uint CircuitCycle { get; set; } - public uint CircuitIsCritical { get; set; } - public uint CircuitOnCmd { get; set; } - public uint CircuitOffCmd { get; set; } - - public DigitalLoggerJoinMap() - { - // Digital - IsOnline = 9; - CircuitState = 0; - CircuitCycle = 0; - CircuitIsCritical = 10; - CircuitOnCmd = 10; - CircuitOffCmd = 20; - // Serial - CircuitNames = 0; - // Analog - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - CircuitNames = CircuitNames + joinOffset; - CircuitState = CircuitState + joinOffset; - CircuitCycle = CircuitCycle + joinOffset; - CircuitIsCritical = CircuitIsCritical + joinOffset; - CircuitOnCmd = CircuitOnCmd + joinOffset; - CircuitOffCmd = CircuitOffCmd + joinOffset; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs index 0ee3d049..cb0f07b2 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs @@ -155,146 +155,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps } } } - -namespace PepperDash_Essentials_Core.Bridges.JoinMaps -{ - /// - /// - /// - [Obsolete("use PepperDash.Essentials.Core.Bridges.JoinMaps version")] - public class GlsPartitionSensorJoinMap:JoinMapBaseAdvanced - { - [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Is Online", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("Name")] - public JoinDataComplete Name = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("Enable")] - public JoinDataComplete Enable = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Enable", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PartitionSensed")] - public JoinDataComplete PartitionSensed = new JoinDataComplete( - new JoinData - { - JoinNumber = 3, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Partition Sensed", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PartitionNotSensed")] - public JoinDataComplete PartitionNotSensed = new JoinDataComplete( - new JoinData - { - JoinNumber = 4, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Partition Not Sensed", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncreaseSensitivity")] - public JoinDataComplete IncreaseSensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 6, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Increase Sensitivity", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DecreaseSensitivity")] - public JoinDataComplete DecreaseSensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 7, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Decrease Sensitivity", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("Sensitivity")] - public JoinDataComplete Sensitivity = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Sensor Sensitivity", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - /// - /// Constructor to use when instantiating this Join Map without inheriting from it - /// - /// Join this join map will start at - public GlsPartitionSensorJoinMap(uint joinStart) - : this(joinStart, typeof(GlsPartitionSensorJoinMap)) - { - - } - - /// - /// Constructor to use when extending this Join map - /// - /// Join this join map will start at - /// Type of the child join map - protected GlsPartitionSensorJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs index 74131e2b..755a586e 100644 --- a/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs +++ b/src/PepperDash.Essentials.Core/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs @@ -1849,1330 +1849,3 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps } } } - - -namespace PepperDash_Essentials_Core.Bridges.JoinMaps -{ - [Obsolete("Use PepperDash.Essentials.Core.Bridges.JoinMaps")] - public class VideoCodecControllerJoinMap : JoinMapBaseAdvanced - { - - #region Digital - - [JoinName("IsOnline")] - public JoinDataComplete IsOnline = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Device is Online", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("1")] - public JoinDataComplete Dtmf1 = new JoinDataComplete( - new JoinData - { - JoinNumber = 11, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 1", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("2")] - public JoinDataComplete Dtmf2 = new JoinDataComplete( - new JoinData - { - JoinNumber = 12, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 2", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("3")] - public JoinDataComplete Dtmf3 = new JoinDataComplete( - new JoinData - { - JoinNumber = 13, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 3", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("4")] - public JoinDataComplete Dtmf4 = new JoinDataComplete( - new JoinData - { - JoinNumber = 14, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 4", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("5")] - public JoinDataComplete Dtmf5 = new JoinDataComplete( - new JoinData - { - JoinNumber = 15, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 5", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("6")] - public JoinDataComplete Dtmf6 = new JoinDataComplete( - new JoinData - { - JoinNumber = 16, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 6", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("7")] - public JoinDataComplete Dtmf7 = new JoinDataComplete( - new JoinData - { - JoinNumber = 17, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 7", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("8")] - public JoinDataComplete Dtmf8 = new JoinDataComplete( - new JoinData - { - JoinNumber = 18, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 8", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("9")] - public JoinDataComplete Dtmf9 = new JoinDataComplete( - new JoinData - { - JoinNumber = 19, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 9", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("0")] - public JoinDataComplete Dtmf0 = new JoinDataComplete( - new JoinData - { - JoinNumber = 20, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF 0", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("*")] - public JoinDataComplete DtmfStar = new JoinDataComplete( - new JoinData - { - JoinNumber = 21, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF *", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("#")] - public JoinDataComplete DtmfPound = new JoinDataComplete( - new JoinData - { - JoinNumber = 22, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "DTMF #", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("EndCall")] - public JoinDataComplete EndCall = new JoinDataComplete( - new JoinData - { - JoinNumber = 24, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Hang Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("HookState")] - public JoinDataComplete HookState = new JoinDataComplete( - new JoinData - { - JoinNumber = 31, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Hook State", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SpeedDialStart")] - public JoinDataComplete SpeedDialStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 41, - JoinSpan = 4 - }, - new JoinMetadata - { - Description = "Speed Dial", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingCall")] - public JoinDataComplete IncomingCall = new JoinDataComplete( - new JoinData - { - JoinNumber = 50, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingAnswer")] - public JoinDataComplete IncomingAnswer = new JoinDataComplete( - new JoinData - { - JoinNumber = 51, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Answer Incoming Call", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("IncomingReject")] - public JoinDataComplete IncomingReject = new JoinDataComplete( - new JoinData - { - JoinNumber = 52, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Reject Incoming Call", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ManualDial")] - public JoinDataComplete ManualDial = new JoinDataComplete( - new JoinData - { - JoinNumber = 71, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial manual string", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialPhoneCall")] - public JoinDataComplete DialPhone = new JoinDataComplete( - new JoinData - { - JoinNumber = 72, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial Phone", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("PhoneHookState")] - public JoinDataComplete PhoneHookState = new JoinDataComplete( - new JoinData - { - JoinNumber = 72, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial Phone", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("EndPhoneCall")] - public JoinDataComplete HangUpPhone = new JoinDataComplete( - new JoinData - { - JoinNumber = 73, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Hang Up PHone", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectorySearchBusy")] - public JoinDataComplete DirectorySearchBusy = new JoinDataComplete( - new JoinData - { - JoinNumber = 100, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Search Busy FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryEntryIsContact")] - public JoinDataComplete DirectoryEntryIsContact = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Selected Entry Is Contact FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryLineSelected")] - public JoinDataComplete DirectoryLineSelected = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Line Selected FB", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryIsRoot")] - public JoinDataComplete DirectoryIsRoot = new JoinDataComplete( - new JoinData - { - JoinNumber = 102, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory is on Root FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryHasChanged")] - public JoinDataComplete DirectoryHasChanged = new JoinDataComplete( - new JoinData - { - JoinNumber = 103, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory has changed FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryRoot")] - public JoinDataComplete DirectoryRoot = new JoinDataComplete( - new JoinData - { - JoinNumber = 104, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Go to Directory Root", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryFolderBack")] - public JoinDataComplete DirectoryFolderBack = new JoinDataComplete( - new JoinData - { - JoinNumber = 105, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Go back one directory level", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DirectoryDialSelectedLine")] - public JoinDataComplete DirectoryDialSelectedLine = new JoinDataComplete( - new JoinData - { - JoinNumber = 106, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Dial selected directory line", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - - [JoinName("CameraTiltUp")] - public JoinDataComplete CameraTiltUp = new JoinDataComplete( - new JoinData - { - JoinNumber = 111, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Tilt Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraTiltDown")] - public JoinDataComplete CameraTiltDown = new JoinDataComplete( - new JoinData - { - JoinNumber = 112, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Tilt Down", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPanLeft")] - public JoinDataComplete CameraPanLeft = new JoinDataComplete( - new JoinData - { - JoinNumber = 113, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Pan Left", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPanRight")] - public JoinDataComplete CameraPanRight = new JoinDataComplete( - new JoinData - { - JoinNumber = 114, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Pan Right", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraZoomIn")] - public JoinDataComplete CameraZoomIn = new JoinDataComplete( - new JoinData - { - JoinNumber = 115, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Zoom In", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraZoomOut")] - public JoinDataComplete CameraZoomOut = new JoinDataComplete( - new JoinData - { - JoinNumber = 116, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Zoom Out", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraPresetSave")] - public JoinDataComplete CameraPresetSave = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Save Selected Preset", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeAuto")] - public JoinDataComplete CameraModeAuto = new JoinDataComplete( - new JoinData - { - JoinNumber = 131, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Auto", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeManual")] - public JoinDataComplete CameraModeManual = new JoinDataComplete( - new JoinData - { - JoinNumber = 132, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Manual", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraModeOff")] - public JoinDataComplete CameraModeOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 133, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Mode Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSelfView")] - public JoinDataComplete CameraSelfView = new JoinDataComplete( - new JoinData - { - JoinNumber = 141, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Self View Toggle/FB", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraLayout")] - public JoinDataComplete CameraLayout = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Layout Toggle", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSupportsAutoMode")] - public JoinDataComplete CameraSupportsAutoMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 143, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Supports Auto Mode FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("CameraSupportsOffMode")] - public JoinDataComplete CameraSupportsOffMode = new JoinDataComplete( - new JoinData - { - JoinNumber = 144, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Supports Off Mode FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("UpdateMeetings")] - public JoinDataComplete UpdateMeetings = new JoinDataComplete( - new JoinData - { - JoinNumber = 160, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Update Meetings", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting1")] - public JoinDataComplete DialMeeting1 = new JoinDataComplete( - new JoinData - { - JoinNumber = 161, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join first meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting2")] - public JoinDataComplete DialMeeting2 = new JoinDataComplete( - new JoinData - { - JoinNumber = 162, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join second meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("DialMeeting3")] - public JoinDataComplete DialMeeting3 = new JoinDataComplete( - new JoinData - { - JoinNumber = 163, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Join third meeting", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteOn")] - public JoinDataComplete MicMuteOn = new JoinDataComplete( - new JoinData - { - JoinNumber = 171, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute On", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteOff")] - public JoinDataComplete MicMuteOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 172, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("MicMuteToggle")] - public JoinDataComplete MicMuteToggle = new JoinDataComplete( - new JoinData - { - JoinNumber = 173, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Mic Mute Toggle", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeUp")] - public JoinDataComplete VolumeUp = new JoinDataComplete( - new JoinData - { - JoinNumber = 174, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Up", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeDown")] - public JoinDataComplete VolumeDown = new JoinDataComplete( - new JoinData - { - JoinNumber = 175, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Down", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteOn")] - public JoinDataComplete VolumeMuteOn = new JoinDataComplete( - new JoinData - { - JoinNumber = 176, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute On", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteOff")] - public JoinDataComplete VolumeMuteOff = new JoinDataComplete( - new JoinData - { - JoinNumber = 177, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute Off", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("VolumeMuteToggle")] - public JoinDataComplete VolumeMuteToggle = new JoinDataComplete( - new JoinData - { - JoinNumber = 178, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Mute Toggle", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SourceShareStart")] - public JoinDataComplete SourceShareStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 201, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Start Sharing & Feedback", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("SourceShareEnd")] - public JoinDataComplete SourceShareEnd = new JoinDataComplete( - new JoinData - { - JoinNumber = 202, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Stop Sharing & Feedback", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("AutoShareWhileInCall")] - public JoinDataComplete SourceShareAutoStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 203, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "When high, will autostart sharing when a call is joined", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("RecievingContent")] - public JoinDataComplete RecievingContent = new JoinDataComplete( - new JoinData - { - JoinNumber = 204, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Recieving content from the far end", - JoinType = eJoinType.Digital, - JoinCapabilities = eJoinCapabilities.ToSIMPL - }); - - [JoinName("SelfviewPosition")] - public JoinDataComplete SelfviewPosition = new JoinDataComplete( - new JoinData - { - JoinNumber = 211, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "advance selfview position", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantAudioMuteToggleStart")] - public JoinDataComplete ParticipantAudioMuteToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 500, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's audio mute status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantVideoMuteToggleStart")] - public JoinDataComplete ParticipantVideoMuteToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 800, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's video mute status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - [JoinName("ParticipantPinToggleStart")] - public JoinDataComplete ParticipantPinToggleStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 1100, - JoinSpan = 50 - }, - new JoinMetadata - { - Description = "Toggles the participant's pin status", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Digital - }); - - #endregion - - - - #region Analog - - [JoinName("MinutesBeforeMeetingStart")] - public JoinDataComplete MinutesBeforeMeetingStart = new JoinDataComplete( - new JoinData - { - JoinNumber = 41, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Minutes before meeting start that a meeting is joinable", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("CameraNumberSelect")] - public JoinDataComplete CameraNumberSelect = new JoinDataComplete( - new JoinData - { - JoinNumber = 60, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Number Select/FB", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("DirectoryRowCount")] - public JoinDataComplete DirectoryRowCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Row Count FB", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("DirectorySelectRow")] - public JoinDataComplete DirectorySelectRow = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Select Row", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("CameraPresetSelect")] - public JoinDataComplete CameraPresetSelect = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Preset Select", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("ParticipantCount")] - public JoinDataComplete ParticipantCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 151, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Participant Count", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("Meeting Count Fb")] - public JoinDataComplete MeetingCount = new JoinDataComplete( - new JoinData - { - JoinNumber = 161, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Meeting Count", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Analog - }); - - [JoinName("VolumeLevel")] - public JoinDataComplete VolumeLevel = new JoinDataComplete( - new JoinData - { - JoinNumber = 174, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Volume Level", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Analog - }); - - #endregion - - - - #region Serials - - [JoinName("CurrentDialString")] - public JoinDataComplete CurrentDialString = new JoinDataComplete( - new JoinData - { - JoinNumber = 1, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Dial String", - JoinCapabilities = eJoinCapabilities.ToFromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("PhoneString")] - public JoinDataComplete PhoneDialString = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Phone Dial String", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CurrentCallName")] - public JoinDataComplete CurrentCallData = new JoinDataComplete( - new JoinData - { - JoinNumber = 2, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Call Data - XSIG", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CallDirection")] - public JoinDataComplete CallDirection = new JoinDataComplete( - new JoinData - { - JoinNumber = 22, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Call Direction", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("IncomingCallName")] - public JoinDataComplete IncomingCallName = new JoinDataComplete( - new JoinData - { - JoinNumber = 51, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("IncomingCallNumber")] - public JoinDataComplete IncomingCallNumber = new JoinDataComplete( - new JoinData - { - JoinNumber = 52, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Incoming Call Number", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - - [JoinName("DirectorySearchString")] - public JoinDataComplete DirectorySearchString = new JoinDataComplete( - new JoinData - { - JoinNumber = 100, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Search String", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntries")] - public JoinDataComplete DirectoryEntries = new JoinDataComplete( - new JoinData - { - JoinNumber = 101, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Directory Entries - XSig, 255 entries", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("Schedule")] - public JoinDataComplete Schedule = new JoinDataComplete( - new JoinData - { - JoinNumber = 102, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Schedule Data - XSIG", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CameraPresetNames")] - public JoinDataComplete CameraPresetNames = new JoinDataComplete( - new JoinData - { - JoinNumber = 121, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Camera Preset Names - XSIG, max of 15", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CameraLayoutStringFb")] - public JoinDataComplete CameraLayoutStringFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 141, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Layout Fb", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("AvailableLayoutsFb")] - public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "xSig of all available layouts", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("SelectLayout")] - public JoinDataComplete SelectLayout = new JoinDataComplete( - new JoinData - { - JoinNumber = 142, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Select Layout by string", - JoinCapabilities = eJoinCapabilities.FromSIMPL, - JoinType = eJoinType.Serial - }); - - - [JoinName("CurrentParticipants")] - public JoinDataComplete CurrentParticipants = new JoinDataComplete( - new JoinData - { - JoinNumber = 151, - JoinSpan = 1 - }, - new JoinMetadata() - { - Description = "Current Participants XSig", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("CurrentSource")] - public JoinDataComplete CurrentSource = new JoinDataComplete( - new JoinData - { - JoinNumber = 201, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Current Source", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("SelfviewPositionFb")] - public JoinDataComplete SelfviewPositionFb = new JoinDataComplete( - new JoinData - { - JoinNumber = 211, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "advance selfview position", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntrySelectedName")] - public JoinDataComplete DirectoryEntrySelectedName = new JoinDataComplete( - new JoinData - { - JoinNumber = 356, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Entry Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectoryEntrySelectedNumber")] - public JoinDataComplete DirectoryEntrySelectedNumber = new JoinDataComplete( - new JoinData - { - JoinNumber = 357, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Entry Number", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - [JoinName("DirectorySelectedFolderName")] - public JoinDataComplete DirectorySelectedFolderName = new JoinDataComplete( - new JoinData - { - JoinNumber = 358, - JoinSpan = 1 - }, - new JoinMetadata - { - Description = "Selected Directory Folder Name", - JoinCapabilities = eJoinCapabilities.ToSIMPL, - JoinType = eJoinType.Serial - }); - - #endregion - - - public VideoCodecControllerJoinMap(uint joinStart) - : base(joinStart, typeof(VideoCodecControllerJoinMap)) - { - } - - public VideoCodecControllerJoinMap(uint joinStart, Type type) - : base(joinStart, type) - { - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs index 2f6050b6..f13e6375 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/ComSpecJsonConverter.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs index 8c132a1b..f7b743cc 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs index bc4e4302..995004b9 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/CommunicationExtras.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs index 8ce6a8c5..8e00e5c1 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericComm.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System; using System.Collections.Generic; using Crestron.SimplSharp.CrestronSockets; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs index 31342a94..fa6c298a 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/GenericHttpClient.cs @@ -9,6 +9,7 @@ using PepperDash.Core.DebugThings; namespace PepperDash.Essentials.Core { + [Obsolete("Please use the builtin HttpClient class instead: https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient-guidelines")] public class GenericHttpClient : Device, IBasicCommunication { public HttpClient Client; diff --git a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs index 4d99edc0..7141613b 100644 --- a/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs +++ b/src/PepperDash.Essentials.Core/Comm and IR/IRPortHelper.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Config/BasicConfig.cs b/src/PepperDash.Essentials.Core/Config/BasicConfig.cs index 728e8dff..6e876de8 100644 --- a/src/PepperDash.Essentials.Core/Config/BasicConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/BasicConfig.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System.Collections.Generic; using System.Linq; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs b/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs index 0d832bfa..0950d62e 100644 --- a/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs +++ b/src/PepperDash.Essentials.Core/Config/ConfigPropertiesHelpers.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using PepperDash.Essentials.Core; using PepperDash.Core; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs index ba21ae38..3eac80d9 100644 --- a/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/DeviceConfig.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs index ae90a1b1..9cdd3e98 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigReader.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs index 71783373..13641a80 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigUpdater.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using Crestron.SimplSharp.Net.Http; using Crestron.SimplSharpPro.Diagnostics; diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs index efb17b51..8c1e8f10 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/ConfigWriter.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; namespace PepperDash.Essentials.Core.Config diff --git a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs index 16b1886b..dac5a35c 100644 --- a/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/Essentials/EssentialsConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Text.RegularExpressions; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs index 820abde5..32a6f71e 100644 --- a/src/PepperDash.Essentials.Core/Config/InfoConfig.cs +++ b/src/PepperDash.Essentials.Core/Config/InfoConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Config { diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs deleted file mode 100644 index f1f1891d..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/C2nIo/C2nIoController.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - public class C2NIoController:CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IRelayPorts - { - private C2nIo _device; - - public C2NIoController(string key, Func preActivationFunc, DeviceConfig config):base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - }); - } - - #region Implementation of IComPorts - - public CrestronCollection ComPorts - { - get { return _device.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _device.NumberOfComPorts; } - } - - #endregion - - #region Implementation of IIROutputPorts - - public CrestronCollection IROutputPorts - { - get { return _device.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _device.NumberOfIROutputPorts; } - } - - #endregion - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _device.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _device.NumberOfRelayPorts; } - } - - #endregion - } - - public class C2NIoControllerFactory : EssentialsDeviceFactory - { - public C2NIoControllerFactory() - { - TypeNames = new List() { "c2nio" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new C2N-IO Device"); - - return new C2NIoController(dc.Key, GetC2NIoDevice, dc); - } - - static C2nIo GetC2NIoDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey); - return new C2nIo(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nIo", parentKey); - return new C2nIo(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs b/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs deleted file mode 100644 index b906219b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/C2nRts/C2nRthsController.cs +++ /dev/null @@ -1,150 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the C2N-RTHS sensor")] - public class C2nRthsController : CrestronGenericBridgeableBaseDevice - { - private C2nRths _device; - - public IntFeedback TemperatureFeedback { get; private set; } - public IntFeedback HumidityFeedback { get; private set; } - - public C2nRthsController(string key, Func preActivationFunc, - DeviceConfig config) - : base(key, config.Name) - { - - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - - TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); - HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); - - if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; - }); - } - - - private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case C2nRths.TemperatureFeedbackEventId: - TemperatureFeedback.FireUpdate(); - break; - case C2nRths.HumidityFeedbackEventId: - HumidityFeedback.FireUpdate(); - break; - } - } - - public void SetTemperatureFormat(bool setToC) - { - _device.TemperatureFormat.BoolValue = setToC; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new C2nRthsControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - - trilist.SetBoolSigAction(joinMap.TemperatureFormat.JoinNumber, SetTemperatureFormat); - - - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - TemperatureFeedback.LinkInputSig(trilist.UShortInput[joinMap.Temperature.JoinNumber]); - HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - - trilist.OnlineStatusChange += (d, args) => - { - if (!args.DeviceOnLine) return; - - UpdateFeedbacksWhenOnline(); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - }; - } - - private void UpdateFeedbacksWhenOnline() - { - IsOnline.FireUpdate(); - TemperatureFeedback.FireUpdate(); - HumidityFeedback.FireUpdate(); - } - - #region PreActivation - - private static C2nRths GetC2nRthsDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey); - return new C2nRths(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths", parentKey); - return new C2nRths(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - public class C2nRthsControllerFactory : EssentialsDeviceFactory - { - public C2nRthsControllerFactory() - { - TypeNames = new List() { "c2nrths" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); - - return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs deleted file mode 100644 index bfb81acd..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3CardControllerBase.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using Crestron.SimplSharpProInternal; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3CardControllerBase:CrestronGenericBaseDevice - { - private readonly C3Card _card; - - public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Overrides of Object - - public override string ToString() - { - return String.Format("{0} {1}", Key, _card.ToString()); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs deleted file mode 100644 index 9658b2bb..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Com3Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Com3Controller:C3CardControllerBase, IComPorts - { - private readonly C3com3 _card; - - public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IComPorts - - public CrestronCollection ComPorts - { - get { return _card.ComPorts; } - } - - public int NumberOfComPorts - { - get { return _card.NumberOfComPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs deleted file mode 100644 index bdf4742d..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Io16Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Io16Controller:C3CardControllerBase,IIOPorts - { - private readonly C3io16 _card; - - public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IIOPorts - - public CrestronCollection VersiPorts - { - get { return _card.VersiPorts; } - } - - public int NumberOfVersiPorts - { - get { return _card.NumberOfVersiPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs deleted file mode 100644 index c35d2038..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ir8Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts - { - private readonly C3ir8 _card; - - public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IIROutputPorts - - public CrestronCollection IROutputPorts - { - get { return _card.IROutputPorts; } - } - - public int NumberOfIROutputPorts - { - get { return _card.NumberOfIROutputPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs deleted file mode 100644 index a68ecaf0..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry16Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ry16Controller:C3CardControllerBase, IRelayPorts - { - private readonly C3ry16 _card; - - public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _card.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _card.NumberOfRelayPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs deleted file mode 100644 index 2fc5fa1b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/C3Ry8Controller.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.ThreeSeriesCards; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - public class C3Ry8Controller:C3CardControllerBase, IRelayPorts - { - private readonly C3ry8 _card; - - public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware) - { - _card = hardware; - } - - #region Implementation of IRelayPorts - - public CrestronCollection RelayPorts - { - get { return _card.RelayPorts; } - } - - public int NumberOfRelayPorts - { - get { return _card.NumberOfRelayPorts; } - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs deleted file mode 100644 index 7e29e0e0..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi31Controller.cs +++ /dev/null @@ -1,118 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")] - public class CenCi31Controller : CrestronGenericBaseDevice - { - private const string CardKeyTemplate = "{0}-card"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlot = 1; - private readonly CenCi31 _cardCage; - private readonly CenCi31Configuration _config; - - private readonly Dictionary> _cardDict; - - public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware) - { - _cardCage = hardware; - - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (c, s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage)) - }, - { - "c3io16", - (c, s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage)) - }, - { - "c3ir8", - (c, s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage)) - }, - { - "c3ry16", - (c, s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage)) - }, - { - "c3ry8", - (c, s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - Func cardBuilder; - - if (String.IsNullOrEmpty(_config.Card)) - { - Debug.Console(0, this, "No card specified"); - return; - } - - if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card); - return; - } - - var device = cardBuilder(_cardCage, CardSlot); - - DeviceManager.AddDevice(device); - } - } - - public class CenCi31Configuration - { - [JsonProperty("card")] - public string Card { get; set; } - } - - public class CenCi31ControllerFactory : EssentialsDeviceFactory - { - public CenCi31ControllerFactory() - { - TypeNames = new List {"cenci31"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new CEN-CI-1"); - - var controlProperties = CommFactory.GetControlPropertiesConfig(dc); - var ipId = controlProperties.IpIdInt; - - var cardCage = new CenCi31(ipId, Global.ControlSystem); - var config = dc.Properties.ToObject(); - - return new CenCi31Controller(dc.Key, dc.Name, config, cardCage); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs deleted file mode 100644 index d1eb0166..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/CenCi33Controller.cs +++ /dev/null @@ -1,133 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] - public class CenCi33Controller : CrestronGenericBaseDevice - { - private const string CardKeyTemplate = "{0}-card{1}"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlots = 3; - private readonly CenCi33 _cardCage; - private readonly CenCi33Configuration _config; - - private readonly Dictionary> _cardDict; - - public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware) - { - _cardCage = hardware; - - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (c, s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage)) - }, - { - "c3io16", - (c, s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage)) - }, - { - "c3ir8", - (c, s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage)) - }, - { - "c3ry16", - (c, s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage)) - }, - { - "c3ry8", - (c, s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - if (_config.Cards == null) - { - Debug.Console(0, this, "No card configuration for this device found"); - return; - } - - for (uint i = 1; i <= CardSlots; i++) - { - string cardType; - if (!_config.Cards.TryGetValue(i, out cardType)) - { - Debug.Console(1, this, "No card found for slot {0}", i); - continue; - } - - if (String.IsNullOrEmpty(cardType)) - { - Debug.Console(0, this, "No card specified for slot {0}", i); - return; - } - - Func cardBuilder; - if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); - return; - } - - var device = cardBuilder(_cardCage, i); - - DeviceManager.AddDevice(device); - } - } - } - - public class CenCi33Configuration - { - [JsonProperty("cards")] - public Dictionary Cards { get; set; } - } - - public class CenCi33ControllerFactory : EssentialsDeviceFactory - { - public CenCi33ControllerFactory() - { - TypeNames = new List {"cenci33"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new CEN-CI-3"); - - var controlProperties = CommFactory.GetControlPropertiesConfig(dc); - var ipId = controlProperties.IpIdInt; - - var cardCage = new CenCi33(ipId, Global.ControlSystem); - var config = dc.Properties.ToObject(); - - return new CenCi33Controller(dc.Key, dc.Name, config, cardCage); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs b/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs deleted file mode 100644 index 97286945..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Cards/InternalCardCageController.cs +++ /dev/null @@ -1,143 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.ThreeSeriesCards; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO.Cards -{ - [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] - public class InternalCardCageController : EssentialsDevice - { - private const string CardKeyTemplate = "{0}-card{1}"; - private const string CardNameTemplate = "{0}:{1}:{2}"; - private const uint CardSlots = 3; - - private readonly InternalCardCageConfiguration _config; - - private readonly Dictionary> _cardDict; - - public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name) - { - _config = config; - - _cardDict = new Dictionary> - { - { - "c3com3", - (s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem)) - }, - { - "c3io16", - (s) => - new C3Io16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem)) - }, - { - "c3ir8", - (s) => - new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem)) - }, - { - "c3ry16", - (s) => - new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem)) - }, - { - "c3ry8", - (s) => - new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem)) - }, - - }; - - GetCards(); - } - - private void GetCards() - { - if (_config.Cards == null) - { - Debug.Console(0, this, "No card configuration for this device found"); - return; - } - - for (uint i = 1; i <= CardSlots; i++) - { - string cardType; - if (!_config.Cards.TryGetValue(i, out cardType)) - { - Debug.Console(0, this, "No card found for slot {0}", i); - continue; - } - - if (String.IsNullOrEmpty(cardType)) - { - Debug.Console(0, this, "No card specified for slot {0}", i); - continue; - } - - Func cardBuilder; - if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) - { - Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); - continue; - } - - try - { - var device = cardBuilder(i); - - - DeviceManager.AddDevice(device); - } - catch (InvalidOperationException ex) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, - "Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}", - cardType, ex.Message, ex.StackTrace); - } - } - } - } - - public class InternalCardCageConfiguration - { - [JsonProperty("cards")] - public Dictionary Cards { get; set; } - } - - public class InternalCardCageControllerFactory : EssentialsDeviceFactory - { - public InternalCardCageControllerFactory() - { - TypeNames = new List {"internalcardcage"}; - } - #region Overrides of EssentialsDeviceFactory - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller"); - - if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards) - { - Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome."); - return null; - } - - var config = dc.Properties.ToObject(); - - return new InternalCardCageController(dc.Key, dc.Name, config); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs deleted file mode 100644 index 414b5432..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/DinCenCnController.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - public class DinCenCn2Controller : CrestronGenericBaseDevice, IHasCresnetBranches - { - private readonly DinCenCn2 _device; - - public CrestronCollection CresnetBranches - { - get { - return _device != null ? _device.Branches : null; - } - } - - public DinCenCn2Controller(string key, string name, DinCenCn2 device, DeviceConfig config) - : base(key, name, device) - { - _device = device; - } - - public class DinCenCn2ControllerFactory : EssentialsDeviceFactory - { - public DinCenCn2ControllerFactory() - { - TypeNames = new List() { "dincencn2", "dincencn2poe", "din-cencn2", "din-cencn2-poe" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new DIN-CEN-CN2 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var ipid = control.IpIdInt; - - if (dc.Type.ToLower().Contains("poe")) - { - return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2Poe(ipid, Global.ControlSystem), dc); - } - - return new DinCenCn2Controller(dc.Key, dc.Name, new DinCenCn2(ipid, Global.ControlSystem), dc); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs deleted file mode 100644 index 794fe609..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/DinIo8/DinIo8Controller.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - public class DinIo8Controller:CrestronGenericBaseDevice, IIOPorts - { - private DinIo8 _device; - - public DinIo8Controller(string key, Func preActivationFunc, DeviceConfig config):base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - }); - } - - #region Implementation of IIOPorts - - public CrestronCollection VersiPorts - { - get { return _device.VersiPorts; } - } - - public int NumberOfVersiPorts - { - get { return _device.NumberOfVersiPorts; } - } - - #endregion - - - } - - public class DinIo8ControllerFactory : EssentialsDeviceFactory - { - public DinIo8ControllerFactory() - { - TypeNames = new List() { "DinIo8" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new DinIo8 Device"); - - return new DinIo8Controller(dc.Key, GetDinIo8Device, dc); - } - - static DinIo8 GetDinIo8Device(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey); - return new DinIo8(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new DinIo8", parentKey); - return new DinIo8(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs deleted file mode 100644 index 50647126..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/CenIoDigIn104Controller.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Essentials.Core.Config; - - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-DIGIN-104 digital input module - /// - [Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")] - public class CenIoDigIn104Controller : CrestronGenericBaseDevice, IDigitalInputPorts - { - public CenIoDi104 Di104 { get; private set; } - - public CenIoDigIn104Controller(string key, string name, CenIoDi104 di104) - : base(key, name) - { - Di104 = di104; - } - - #region IDigitalInputPorts Members - - public CrestronCollection DigitalInputPorts - { - get { return Di104.DigitalInputPorts; } - } - - public int NumberOfDigitalInputPorts - { - get { return Di104.NumberOfDigitalInputPorts; } - } - - #endregion - } - - public class CenIoDigIn104ControllerFactory : EssentialsDeviceFactory - { - public CenIoDigIn104ControllerFactory() - { - TypeNames = new List() { "ceniodigin104" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - if (control == null) - { - Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found"); - return null; - } - var ipid = control.IpIdInt; - if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid); - return null; - } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs deleted file mode 100644 index d994a11c..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Ir/CenIoIr104Controller.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Essentials.Core.Config; - - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-IR-104 module - /// - [Description("Wrapper class for the CEN-IO-IR-104 module")] - public class CenIoIr104Controller : CrestronGenericBaseDevice, IIROutputPorts - { - private readonly CenIoIr104 _ir104; - - /// - /// Constructor - /// - /// - /// - /// - public CenIoIr104Controller(string key, string name, CenIoIr104 ir104) - : base(key, name, ir104) - { - _ir104 = ir104; - } - - #region IDigitalInputPorts Members - - /// - /// IR port collection - /// - public CrestronCollection IROutputPorts - { - get { return _ir104.IROutputPorts; } - } - - /// - /// Number of relay ports property - /// - public int NumberOfIROutputPorts - { - get { return _ir104.NumberOfIROutputPorts; } - } - - #endregion - } - - /// - /// CEN-IO-IR-104 controller fatory - /// - public class CenIoIr104ControllerFactory : EssentialsDeviceFactory - { - /// - /// Constructor - /// - public CenIoIr104ControllerFactory() - { - TypeNames = new List() { "cenioir104" }; - } - - /// - /// Build device CEN-IO-IR-104 - /// - /// - /// - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - if (control == null) - { - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found"); - return null; - } - - var ipid = control.IpIdInt; - if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid); - return null; - } - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs b/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs deleted file mode 100644 index ba13ede8..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/Relay/CenIoRy104Controller.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - /// - /// Wrapper class for CEN-IO-RY-104 relay module - /// - [Description("Wrapper class for the CEN-IO-RY-104 relay module")] - public class CenIoRy104Controller : CrestronGenericBaseDevice, IRelayPorts - { - private readonly CenIoRy104 _ry104; - - /// - /// Constructor - /// - /// - /// - /// - public CenIoRy104Controller(string key, string name, CenIoRy104 ry104) - : base(key, name, ry104) - { - _ry104 = ry104; - } - - /// - /// Relay port collection - /// - public CrestronCollection RelayPorts - { - get { return _ry104.RelayPorts; } - } - - /// - /// Number of relay ports property - /// - public int NumberOfRelayPorts - { - get { return _ry104.NumberOfRelayPorts; } - } - } - - /// - /// CEN-IO-RY Controller factory - /// - public class CenIoRy104ControllerFactory : EssentialsDeviceFactory - { - /// - /// Constructor - /// - public CenIoRy104ControllerFactory() - { - TypeNames = new List() { "ceniory104" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create a new CEN-IO-RY-104 Device"); - - var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc); - if (controlPropertiesConfig == null) - { - Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found"); - return null; - } - - var ipid = controlPropertiesConfig.IpIdInt; - if (ipid != 0) return new CenIoRy104Controller(dc.Key, dc.Name, new CenIoRy104(ipid, Global.ControlSystem)); - - Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device using IP-ID-{0}", ipid); - return null; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs b/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs deleted file mode 100644 index 3fd66f3b..00000000 --- a/src/PepperDash.Essentials.Core/Crestron IO/StatusSign/StatusSignController.cs +++ /dev/null @@ -1,225 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the Crestron StatusSign device")] - public class StatusSignController : CrestronGenericBridgeableBaseDevice - { - private StatusSign _device; - - public BoolFeedback RedLedEnabledFeedback { get; private set; } - public BoolFeedback GreenLedEnabledFeedback { get; private set; } - public BoolFeedback BlueLedEnabledFeedback { get; private set; } - - public IntFeedback RedLedBrightnessFeedback { get; private set; } - public IntFeedback GreenLedBrightnessFeedback { get; private set; } - public IntFeedback BlueLedBrightnessFeedback { get; private set; } - - public StatusSignController(string key, Func preActivationFunc, DeviceConfig config) : base(key, config.Name) - { - AddPreActivationAction(() => - { - _device = preActivationFunc(config); - - RegisterCrestronGenericBase(_device); - - RedLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Red] - .ControlFeedback.BoolValue); - GreenLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Green] - .ControlFeedback.BoolValue); - BlueLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue] - .ControlFeedback.BoolValue); - - RedLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback); - GreenLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback); - BlueLedBrightnessFeedback = - new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - - if (_device != null) _device.BaseEvent += _device_BaseEvent; - - }); - } - - void _device_BaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case StatusSign.LedBrightnessFeedbackEventId: - RedLedBrightnessFeedback.FireUpdate(); - GreenLedBrightnessFeedback.FireUpdate(); - BlueLedBrightnessFeedback.FireUpdate(); - break; - case StatusSign.LedControlFeedbackEventId: - RedLedEnabledFeedback.FireUpdate(); - GreenLedEnabledFeedback.FireUpdate(); - BlueLedEnabledFeedback.FireUpdate(); - break; - } - } - - public void EnableLedControl(bool red, bool green, bool blue) - { - _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; - } - - public void SetColor(uint red, uint green, uint blue) - { - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); - } - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); - } - - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); - } - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new StatusSignControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); - - trilist.SetUShortSigAction(joinMap.RedLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.GreenLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - trilist.SetUShortSigAction(joinMap.BlueLed.JoinNumber, u => SetColor(trilist, joinMap, this)); - - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl.JoinNumber]); - BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl.JoinNumber]); - GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl.JoinNumber]); - - RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); - BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); - GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); - } - - private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue; - var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; - device.EnableLedControl(redEnable, greenEnable, blueEnable); - } - - private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) - { - var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue; - var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; - - device.SetColor(redBrightness, greenBrightness, blueBrightness); - } - - #region PreActivation - - private static StatusSign GetStatusSignDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey); - return new StatusSign(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign", parentKey); - return new StatusSign(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - public class StatusSignControllerFactory : EssentialsDeviceFactory - { - public StatusSignControllerFactory() - { - TypeNames = new List() { "statussign" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new StatusSign Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new StatusSignController(dc.Key, GetStatusSignDevice, dc); - } - } - } - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs index d9650e63..9d8ebe3d 100644 --- a/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs +++ b/src/PepperDash.Essentials.Core/Crestron/CrestronGenericBaseDevice.cs @@ -8,9 +8,6 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core { - /// - /// A bridge class to cover the basic features of GenericBase hardware - /// public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking { protected GenericBase Hardware; diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs similarity index 99% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericDigitalInputDevice.cs rename to src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs index 589e4fe5..4078c331 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericDigitalInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/GenericRelayDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs similarity index 99% rename from src/PepperDash.Essentials.Core/Crestron IO/Relay/GenericRelayDevice.cs rename to src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs index 44ddef63..b8c580df 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/Relay/GenericRelayDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericRelayDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs similarity index 99% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs rename to src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs index 5da79bbf..a0fbd03d 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportAnalogInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportAnalogInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs similarity index 99% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs rename to src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs index fd215545..aa25e6b4 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/GenericVersiportInputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportInputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs similarity index 99% rename from src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs rename to src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs index 2b3d0fab..8dda5bfb 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/GenericVersiportOutputDevice.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/GenericVersiportOutputDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/IAnalogInput.cs b/src/PepperDash.Essentials.Core/CrestronIO/IAnalogInput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/IAnalogInput.cs rename to src/PepperDash.Essentials.Core/CrestronIO/IAnalogInput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Inputs/IDigitalInput.cs b/src/PepperDash.Essentials.Core/CrestronIO/IDigitalInput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Inputs/IDigitalInput.cs rename to src/PepperDash.Essentials.Core/CrestronIO/IDigitalInput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Outputs/IDigitalOutput.cs b/src/PepperDash.Essentials.Core/CrestronIO/IDigitalOutput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Outputs/IDigitalOutput.cs rename to src/PepperDash.Essentials.Core/CrestronIO/IDigitalOutput.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/IHasCresnetBranches.cs b/src/PepperDash.Essentials.Core/CrestronIO/IHasCresnetBranches.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/DinCenCn/IHasCresnetBranches.cs rename to src/PepperDash.Essentials.Core/CrestronIO/IHasCresnetBranches.cs diff --git a/src/PepperDash.Essentials.Core/Crestron IO/IOPortConfig.cs b/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs similarity index 91% rename from src/PepperDash.Essentials.Core/Crestron IO/IOPortConfig.cs rename to src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs index 13d35fb5..ab269f08 100644 --- a/src/PepperDash.Essentials.Core/Crestron IO/IOPortConfig.cs +++ b/src/PepperDash.Essentials.Core/CrestronIO/IOPortConfig.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.CrestronIO { diff --git a/src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs b/src/PepperDash.Essentials.Core/CrestronIO/ISwitchedOutput.cs similarity index 100% rename from src/PepperDash.Essentials.Core/Crestron IO/Relay/ISwitchedOutput.cs rename to src/PepperDash.Essentials.Core/CrestronIO/ISwitchedOutput.cs diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs index 63f4917a..10db107f 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasBranding.cs @@ -7,14 +7,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces bool BrandingEnabled { get; } void InitializeBranding(string roomKey); } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface IHasBranding - { - bool BrandingEnabled { get; } - void InitializeBranding(string roomKey); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs index 7f75adec..cd208d4b 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasPhoneDialing.cs @@ -12,18 +12,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces void EndPhoneCall(); void SendDtmfToPhone(string digit); } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface IHasPhoneDialing - { - BoolFeedback PhoneOffHookFeedback { get; } - StringFeedback CallerIdNameFeedback { get; } - StringFeedback CallerIdNumberFeedback { get; } - void DialPhoneCall(string number); - void EndPhoneCall(); - void SendDtmfToPhone(string digit); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs index abf138a4..181cac35 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageDefinition.cs @@ -16,20 +16,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces List RoomNames { get; set; } } } - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface ILanguageDefinition - { - string LocaleName { get; set; } - string FriendlyName { get; set; } - bool Enable { get; set; } - List UiLabels { get; set; } - List Sources { get; set; } - List Destinations { get; set; } - List SourceGroupNames { get; set; } - List DestinationGroupNames { get; set; } - List RoomNames { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs index dd48723d..428f78c3 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ILanguageProvider.cs @@ -11,15 +11,3 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces } } - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public interface ILanguageProvider - { - ILanguageDefinition CurrentLanguage { get; set; } - - event EventHandler CurrentLanguageChanged; - } - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs index cd921e3b..28befce8 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IMobileControl.cs @@ -65,6 +65,8 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces event EventHandler ClientJoined; + event EventHandler AppUrlChanged; + string UserCode { get; } string QrCodeUrl { get; } @@ -74,5 +76,7 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces string McServerUrl { get; } string RoomName { get; } + + string AppUrl { get; } } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs index 0fcf32e9..b7c3345e 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IPower.cs @@ -13,17 +13,6 @@ using PepperDash.Essentials.Core.SmartObjects; namespace PepperDash.Essentials.Core { - /// - /// Defines the ability to power a device on and off - /// - [Obsolete("Will be replaced by IHasPowerControlWithFeedback")] - public interface IPower - { - void PowerOn(); - void PowerOff(); - void PowerToggle(); - BoolFeedback PowerIsOnFeedback { get; } - } /// /// Adds feedback for current power state diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs index c7d26722..890d1416 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/LanguageLabel.cs @@ -10,16 +10,4 @@ namespace PepperDash.Essentials.Core.DeviceTypeInterfaces public string DisplayText { get; set; } public uint JoinNumber { get; set; } } -} - -namespace PepperDash_Essentials_Core.DeviceTypeInterfaces -{ - [Obsolete("Use PepperDash.Essentials.Core.DeviceTypeInterfaces")] - public class LanguageLabel - { - public string Key { get; set; } - public string Description { get; set; } - public string DisplayText { get; set; } - public uint JoinNumber { get; set; } - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs index a3314e9c..946ece3b 100644 --- a/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs +++ b/src/PepperDash.Essentials.Core/Devices/DestinationListItem.cs @@ -1,6 +1,6 @@ -extern alias Full; + -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs index dafda2a9..d4c3313d 100644 --- a/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs +++ b/src/PepperDash.Essentials.Core/Devices/DeviceJsonApi.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections; @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; diff --git a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs index 178e0c30..b7c15fce 100644 --- a/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs +++ b/src/PepperDash.Essentials.Core/Devices/GenericIRController.cs @@ -1,10 +1,10 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs b/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs index e7267782..1bf8edb9 100644 --- a/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/GenericMonitoredTcpDevice.cs @@ -35,35 +35,6 @@ namespace PepperDash.Essentials.Core.Devices { } - - /// - /// Generic monitor for TCP reachability. Default with 30s poll, 120s warning and 300s error times - /// - [Obsolete] - public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString) - : this(key, name, hostname, port, pollString, 30000, 120000, 300000) - { - } - - /// - /// Monitor for TCP reachability - /// - [Obsolete] - public GenericCommunicationMonitoredDevice(string key, string name, string hostname, int port, string pollString, - long pollTime, long warningTime, long errorTime) - : base(key, name) - { - Client = new GenericTcpIpClient(key + "-tcp", hostname, port, 512); - CommunicationMonitor = new GenericCommunicationMonitor(this, Client, pollTime, warningTime, errorTime, pollString); - - // ------------------------------------------------------DELETE THIS - CommunicationMonitor.StatusChange += (o, a) => - { - Debug.Console(2, this, "Communication monitor status change: {0}", a.Status); - }; - } - - public override bool CustomActivate() { CommunicationMonitor.Start(); diff --git a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs index 6ffee074..d65d1f7b 100644 --- a/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs +++ b/src/PepperDash.Essentials.Core/Devices/IrOutputPortController.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using PepperDash.Essentials.Core.Config; diff --git a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs index 03e884f0..12b3f0c8 100644 --- a/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs +++ b/src/PepperDash.Essentials.Core/Devices/PC/InRoomPc.cs @@ -10,9 +10,7 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Devices { - /// - /// This DVD class should cover most IR, one-way DVD and Bluray fuctions - /// + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class InRoomPc : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } @@ -65,6 +63,7 @@ namespace PepperDash.Essentials.Core.Devices #endregion } + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class InRoomPcFactory : EssentialsDeviceFactory { public InRoomPcFactory() diff --git a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs index a2864d77..28069c76 100644 --- a/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs +++ b/src/PepperDash.Essentials.Core/Devices/PC/Laptop.cs @@ -10,10 +10,9 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Devices { - /// - /// This DVD class should cover most IR, one-way DVD and Bluray fuctions - /// - public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking + + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] + public class Laptop : EssentialsDevice, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking { public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } } public string IconName { get; set; } @@ -65,6 +64,7 @@ namespace PepperDash.Essentials.Core.Devices #endregion } + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class LaptopFactory : EssentialsDeviceFactory { public LaptopFactory() diff --git a/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs b/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs index adb427fb..41555ae8 100644 --- a/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs +++ b/src/PepperDash.Essentials.Core/Devices/PresentationDeviceType.cs @@ -9,18 +9,6 @@ using Crestron.SimplSharpPro.UI; namespace PepperDash.Essentials.Core { - //[Obsolete] - //public class PresentationDeviceType - //{ - // public const ushort Default = 1; - // public const ushort CableSetTopBox = 2; - // public const ushort SatelliteSetTopBox = 3; - // public const ushort Dvd = 4; - // public const ushort Bluray = 5; - // public const ushort PC = 9; - // public const ushort Laptop = 10; - //} - public enum PresentationSourceType { None, Dvd, Laptop, PC, SetTopBox, VCR diff --git a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs index 50bf90bd..1da908a9 100644 --- a/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs +++ b/src/PepperDash.Essentials.Core/Devices/ReconfigurableDevice.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -9,8 +9,8 @@ using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core.Devices { diff --git a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs index 87c66e75..491f76a9 100644 --- a/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs +++ b/src/PepperDash.Essentials.Core/Devices/SourceListItem.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,9 +6,9 @@ using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; using PepperDash.Core; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs index 7a8eb8b1..121a1874 100644 --- a/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/BasicIrDisplay.cs @@ -14,15 +14,12 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core { - [Description("Wrapper class for a Basic IR Display")] + [Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")] public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced { public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } - [Obsolete("This property will be removed in version 2.0.0")] - public override BoolFeedback PowerIsOnFeedback { get; protected set; } - protected Func PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } @@ -46,14 +43,6 @@ namespace PepperDash.Essentials.Core IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); DeviceManager.AddDevice(IrPort); - PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc); - - PowerIsOnFeedback.OutputChange += (o, a) => - { - Debug.Console(2, this, "Power on={0}", _PowerIsOn); - if (_PowerIsOn) StartWarmingTimer(); - else StartCoolingTimer(); - }; IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); @@ -117,20 +106,17 @@ namespace PepperDash.Essentials.Core { IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); _PowerIsOn = true; - PowerIsOnFeedback.FireUpdate(); } public override void PowerOff() { _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); } public override void PowerToggle() { _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); } @@ -193,7 +179,7 @@ namespace PepperDash.Essentials.Core action(); }; - if (!PowerIsOnFeedback.BoolValue) + if (!_PowerIsOn) { PowerOn(); EventHandler oneTimer = null; @@ -217,6 +203,7 @@ namespace PepperDash.Essentials.Core } } + [Obsolete("Please use PepperDash.Essentials.Device.Common, this will be removed in 2.1")] public class BasicIrDisplayFactory : EssentialsDeviceFactory { public BasicIrDisplayFactory() diff --git a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs index a8de2796..9ba42cab 100644 --- a/src/PepperDash.Essentials.Core/Display/DisplayBase.cs +++ b/src/PepperDash.Essentials.Core/Display/DisplayBase.cs @@ -1,26 +1,22 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; -using System.Text; using Crestron.SimplSharp; -using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core { - /// - /// - /// - public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking, IPower + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] + public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking { public event SourceInfoChangeHandler CurrentSourceChange; @@ -51,9 +47,6 @@ namespace PepperDash.Essentials.Core public BoolFeedback IsCoolingDownFeedback { get; protected set; } public BoolFeedback IsWarmingUpFeedback { get; private set; } - [Obsolete("This property will be removed in version 2.0.0")] - public abstract BoolFeedback PowerIsOnFeedback { get; protected set; } - public UsageTracking UsageTracker { get; set; } public uint WarmupTime { get; set; } @@ -260,16 +253,14 @@ namespace PepperDash.Essentials.Core } - /// - /// - /// + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback { public StringFeedback CurrentInputFeedback { get; private set; } abstract protected Func CurrentInputFeedbackFunc { get; } - public override BoolFeedback PowerIsOnFeedback { get; protected set; } + public BoolFeedback PowerIsOnFeedback { get; protected set; } abstract protected Func PowerIsOnFeedbackFunc { get; } diff --git a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs index d7f36f13..db568519 100644 --- a/src/PepperDash.Essentials.Core/Display/MockDisplay.cs +++ b/src/PepperDash.Essentials.Core/Display/MockDisplay.cs @@ -16,10 +16,8 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core { - /// - /// - /// - public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] + public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced { public RoutingInputPort HdmiIn1 { get; private set; } @@ -220,6 +218,8 @@ namespace PepperDash.Essentials.Core } } + + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public class MockDisplayFactory : EssentialsDeviceFactory { public MockDisplayFactory() diff --git a/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs b/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs index f001c985..2d71c6bc 100644 --- a/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs +++ b/src/PepperDash.Essentials.Core/Extensions/JsonExtensions.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PepperDash.Essentials.Core { diff --git a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs index 87dc54b6..db6c07cc 100644 --- a/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/DeviceFactory.cs @@ -1,8 +1,8 @@ -extern alias Full; + using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; using System; diff --git a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs index a5b57ad3..4f78892a 100644 --- a/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs +++ b/src/PepperDash.Essentials.Core/Factory/ProcessorExtensionDeviceFactory.cs @@ -1,6 +1,6 @@ -extern alias Full; + using Crestron.SimplSharp.Reflection; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -70,9 +70,9 @@ namespace PepperDash.Essentials.Core ProcessorExtensionDeviceFactory.ProcessorExtensionFactoryMethods.Add(extensionName, wrapper); } - private static void CheckForSecrets(IEnumerable obj) + private static void CheckForSecrets(IEnumerable obj) { - foreach (var prop in obj.Where(prop => prop.Value as Full.Newtonsoft.Json.Linq.JObject != null)) + foreach (var prop in obj.Where(prop => prop.Value as Newtonsoft.Json.Linq.JObject != null)) { if (prop.Name.ToLower() == "secret") { @@ -80,7 +80,7 @@ namespace PepperDash.Essentials.Core //var secret = GetSecret(JsonConvert.DeserializeObject(prop.Children().First().ToString())); prop.Parent.Replace(secret); } - var recurseProp = prop.Value as Full.Newtonsoft.Json.Linq.JObject; + var recurseProp = prop.Value as Newtonsoft.Json.Linq.JObject; if (recurseProp == null) return; CheckForSecrets(recurseProp.Properties()); } @@ -120,7 +120,7 @@ namespace PepperDash.Essentials.Core var typeName = localDc.Type.ToLower(); - var jObject = properties as Full.Newtonsoft.Json.Linq.JObject; + var jObject = properties as Newtonsoft.Json.Linq.JObject; if (jObject != null) { var jProp = jObject.Properties(); diff --git a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs index be8369d2..6ccc0600 100644 --- a/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs +++ b/src/PepperDash.Essentials.Core/Factory/ReadyEventArgs.cs @@ -23,24 +23,3 @@ namespace PepperDash.Essentials.Core bool IsReady { get; } } } - -namespace PepperDash_Essentials_Core -{ - [Obsolete("Use PepperDash.Essentials.Core")] - public class IsReadyEventArgs : EventArgs - { - public bool IsReady { get; set; } - - public IsReadyEventArgs(bool data) - { - IsReady = data; - } - } - - [Obsolete("Use PepperDash.Essentials.Core")] - public interface IHasReady - { - event EventHandler IsReadyEvent; - bool IsReady { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 597a31fd..b15fe095 100644 --- a/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/src/PepperDash.Essentials.Core/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ using Crestron.SimplSharp.CrestronXml; using Crestron.SimplSharp.CrestronXml.Serialization; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.Fusion; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Config; @@ -252,7 +252,7 @@ namespace PepperDash.Essentials.Core.Fusion ? new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets) : new FusionRoomGuids(Room.Name, _ipId, RoomGuid, FusionStaticAssets, FusionOccSensor); - var json = JsonConvert.SerializeObject(_guiDs, Full.Newtonsoft.Json.Formatting.Indented); + var json = JsonConvert.SerializeObject(_guiDs, Newtonsoft.Json.Formatting.Indented); using (var sw = new StreamWriter(filePath)) { diff --git a/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs b/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs index 82f3b972..86eeffc3 100644 --- a/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs +++ b/src/PepperDash.Essentials.Core/Fusion/FusionCustomPropertiesBridge.cs @@ -1,12 +1,12 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; diff --git a/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs b/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs deleted file mode 100644 index 7134106f..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/CenCn2Controller.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash_Essentials_Core.Gateways -{ - public class CenCn2Controller - { - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs b/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs deleted file mode 100644 index 588a5701..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/CenRfgwController.cs +++ /dev/null @@ -1,197 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.Gateways; -using Full.Newtonsoft.Json; -using Crestron.SimplSharpPro.DeviceSupport; - - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Crestron Infinet-EX Gateways")] - public class CenRfgwController : CrestronGenericBaseDevice, IHasReady - { - public event EventHandler IsReadyEvent; - - public bool IsReady { get; private set; } - - private GatewayBase _gateway; - - public GatewayBase GateWay - { - get { return _gateway; } - } - - /// - /// Constructor for the on-board gateway - /// - /// - /// - /// - public CenRfgwController(string key, string name, GatewayBase gateway) : - base(key, name, gateway) - { - _gateway = gateway; - IsReady = true; - FireIsReadyEvent(IsReady); - } - - public CenRfgwController(string key, Func preActivationFunc, DeviceConfig config) : - base(key, config.Name) - { - IsReady = false; - FireIsReadyEvent(IsReady); - AddPreActivationAction(() => - { - _gateway = preActivationFunc(config); - - IsReady = true; - RegisterCrestronGenericBase(_gateway); - FireIsReadyEvent(IsReady); - - }); - } - - public static GatewayBase GetNewIpRfGateway(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var type = dc.Type; - var ipId = control.IpIdInt; - - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwEx(ipId, Global.ControlSystem); - } - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoe(ipId, Global.ControlSystem); - } - return null; - } - - private void FireIsReadyEvent(bool data) - { - var handler = IsReadyEvent; - if (handler == null) return; - - handler(this, new IsReadyEventArgs(data)); - - } - - public static GatewayBase GetNewSharedIpRfGateway(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var ipId = control.IpIdInt; - - if (dc.Type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExEthernetSharable(ipId, Global.ControlSystem); - } - if (dc.Type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeEthernetSharable(ipId, Global.ControlSystem); - } - return null; - } - - public static GatewayBase GetCenRfgwCresnetController(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var type = dc.Type; - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey); - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeCresnet(cresnetId, Global.ControlSystem); - } - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExCresnet(cresnetId, Global.ControlSystem); - } - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new CenRfgw", parentKey); - - if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenErfgwPoeCresnet(cresnetId, cresnetBridge.Branches[branchId]); - } - if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) - { - return new CenRfgwExCresnet(cresnetId, cresnetBridge.Branches[branchId]); - } - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - - - - - - - - public enum EExGatewayType - { - Ethernet, - EthernetShared, - Cresnet - } - - - #region Factory - - public class CenRfgwControllerFactory : EssentialsDeviceFactory - { - public CenRfgwControllerFactory() - { - TypeNames = new List {"cenrfgwex", "cenerfgwpoe"}; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - - Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - EExGatewayType gatewayType = - (EExGatewayType) Enum.Parse(typeof (EExGatewayType), props.GatewayType, true); - - switch (gatewayType) - { - case (EExGatewayType.Ethernet): - return new CenRfgwController(dc.Key, dc.Name, GetNewIpRfGateway(dc)); - case (EExGatewayType.EthernetShared): - return new CenRfgwController(dc.Key, dc.Name, GetNewSharedIpRfGateway(dc)); - case (EExGatewayType.Cresnet): - return new CenRfgwController(dc.Key, GetCenRfgwCresnetController, dc); - } - return null; - } - } - - #endregion - } - - -} - - diff --git a/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs b/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs deleted file mode 100644 index 353e73b9..00000000 --- a/src/PepperDash.Essentials.Core/Gateways/EssentialsRfGatewayConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - - -namespace PepperDash.Essentials.Core -{ - public class EssentialsRfGatewayConfig - { - [JsonProperty("control")] - public EssentialsControlPropertiesConfig Control { get; set; } - - [JsonProperty("gatewayType")] - public string GatewayType { get; set; } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Global/Global.cs b/src/PepperDash.Essentials.Core/Global/Global.cs index d9e56673..59d37b56 100644 --- a/src/PepperDash.Essentials.Core/Global/Global.cs +++ b/src/PepperDash.Essentials.Core/Global/Global.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Linq; @@ -14,9 +14,9 @@ using Crestron.SimplSharpPro.DM; using PepperDash.Core; using PepperDash.Essentials.License; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Linq; -using Full.Newtonsoft.Json.Schema; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Schema; namespace PepperDash.Essentials.Core diff --git a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs index 6dff477d..6138c003 100644 --- a/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs +++ b/src/PepperDash.Essentials.Core/JoinMaps/JoinMapBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using Crestron.SimplSharp; using PepperDash.Core; using PepperDash.Essentials.Core.Config; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core { @@ -81,97 +81,6 @@ namespace PepperDash.Essentials.Core } - /// - /// Base class for join maps - /// - [Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")] - public abstract class JoinMapBase - { - /// - /// Modifies all the join numbers by adding the offset. This should never be called twice - /// - /// - public abstract void OffsetJoinNumbers(uint joinStart); - - /// - /// The collection of joins and associated metadata - /// - public Dictionary Joins = new Dictionary(); - - /// - /// Prints the join information to console - /// - public void PrintJoinMapInfo() - { - CrestronConsole.ConsoleCommandResponse("{0}:\n", GetType().Name); - - // Get the joins of each type and print them - CrestronConsole.ConsoleCommandResponse("Digitals:"); - var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Digital Joins", digitals.Count); - PrintJoinList(GetSortedJoins(digitals)); - - CrestronConsole.ConsoleCommandResponse("Analogs:"); - var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Analog Joins", analogs.Count); - PrintJoinList(GetSortedJoins(analogs)); - - CrestronConsole.ConsoleCommandResponse("Serials:"); - var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); - CrestronConsole.ConsoleCommandResponse("Found {0} Serial Joins", serials.Count); - PrintJoinList(GetSortedJoins(serials)); - - } - - /// - /// Returns a sorted list by JoinNumber - /// - /// - /// - List> GetSortedJoins(Dictionary joins) - { - var sortedJoins = joins.ToList(); - - sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); - - return sortedJoins; - } - - void PrintJoinList(List> joins) - { - foreach (var join in joins) - { - CrestronConsole.ConsoleCommandResponse( - @"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'", - join.Value.JoinNumber, - join.Value.Label, - join.Value.JoinSpan, - join.Value.JoinType.ToString(), - join.Value.JoinCapabilities.ToString()); - } - } - - /// - /// Returns the join number for the join with the specified key - /// - /// - /// - public uint GetJoinForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; - } - - /// - /// Returns the join span for the join with the specified key - /// - /// - /// - public uint GetJoinSpanForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; - } - } - /// /// Base class for join maps /// @@ -432,27 +341,6 @@ namespace PepperDash.Essentials.Core public class JoinMetadata { private string _description; - - /// - /// Join number (based on join offset value) - /// - [JsonProperty("joinNumber")] - [Obsolete] - public uint JoinNumber { get; set; } - /// - /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range - /// - [Obsolete] - [JsonProperty("joinSpan")] - public uint JoinSpan { get; set; } - - /// - /// A label for the join to better describe its usage - /// - [Obsolete("Use Description instead")] - [JsonProperty("label")] - public string Label { get { return _description; } set { _description = value; } } - /// /// A description for the join to better describe its usage /// diff --git a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs index 5bb677a2..e144ea62 100644 --- a/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs +++ b/src/PepperDash.Essentials.Core/Lighting/LightingBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,12 +7,13 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.Lighting { + [Obsolete("Please use PepperDash.Essentials.Devices.Common, this will be removed in 2.1")] public abstract class LightingBase : EssentialsBridgeableDevice, ILightingScenes { #region ILightingScenes Members diff --git a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs index 1066637c..2b5b6ea2 100644 --- a/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs +++ b/src/PepperDash.Essentials.Core/Monitoring/SystemMonitorController.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -7,8 +7,8 @@ using Crestron.SimplSharp; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.Diagnostics; using PepperDash.Core; -using Full.Newtonsoft.Json; -using Full.Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core.Monitoring diff --git a/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs b/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs deleted file mode 100644 index 5b778a6d..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/CenOdtOccupancySensorBaseController.cs +++ /dev/null @@ -1,777 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Resources; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for CEN-ODT-C-POE")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")] - public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider - { - public CenOdtCPoe OccSensor { get; private set; } - - public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; } - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } - - public BoolFeedback RawOccupancyFeedback { get; private set; } - - public BoolFeedback PirSensorEnabledFeedback { get; private set; } - - public BoolFeedback LedFlashEnabledFeedback { get; private set; } - - public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } - - public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } - - public IntFeedback CurrentTimeoutFeedback { get; private set; } - - public IntFeedback RemoteTimeoutFeedback { get; private set; } - - public IntFeedback InternalPhotoSensorValue { get; set; } - - public IntFeedback ExternalPhotoSensorValue { get; set; } - - public BoolFeedback OrWhenVacatedFeedback { get; private set; } - - public BoolFeedback AndWhenVacatedFeedback { get; private set; } - - public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } - - public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } - - public BoolFeedback RawOccupancyPirFeedback { get; private set; } - - public BoolFeedback RawOccupancyUsFeedback { get; private set; } - - public BoolFeedback IdentityModeFeedback { get; private set; } - - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } - - public Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; - } - } - - public CenOdtOccupancySensorBaseController(string key, string name, CenOdtCPoe sensor, GlsOccupancySensorPropertiesConfig config) - : base(key, name, sensor) - { - PropertiesConfig = config; - - OccSensor = sensor; - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue); - - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - PirSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); - - PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback); - - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - - RemoteTimeoutFeedback = new IntFeedback(() => OccSensor.RemoteTimeout.UShortValue); - - GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedFeedback.BoolValue); - - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - - //ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ex.UShortValue); - - AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); - - OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); - - UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue); - - UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); - - RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByPassiveInfraredSensorFeedback.BoolValue); - - RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyDetectedByUltrasonicSensorFeedback.BoolValue); - - IdentityModeFeedback = new BoolFeedback(()=>OccSensor.IdentityModeOnFeedback.BoolValue); - - UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); - - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback); - - OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); - - OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange); - - AddPostActivationAction(() => - { - OccSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (OccSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - - } - }); - } - - /// - /// Applies any sensor settings defined in config - /// - protected virtual void ApplySettingsToSensorFromConfig() - { - Debug.Console(1, this, "Checking config for settings to apply"); - - if (PropertiesConfig.EnablePir != null) - { - SetPirEnable((bool)PropertiesConfig.EnablePir); - } - - if (PropertiesConfig.EnableLedFlash != null) - { - SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash); - } - - if (PropertiesConfig.RemoteTimeout != null) - { - SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout); - } - - if (PropertiesConfig.ShortTimeoutState != null) - { - SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState); - } - - if (PropertiesConfig.EnableRawStates != null) - { - EnableRawStates((bool)PropertiesConfig.EnableRawStates); - } - - if (PropertiesConfig.InternalPhotoSensorMinChange != null) - { - SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange); - } - - if (PropertiesConfig.EnableUsA != null) - { - SetUsAEnable((bool)PropertiesConfig.EnableUsA); - } - - if (PropertiesConfig.EnableUsB != null) - { - SetUsBEnable((bool)PropertiesConfig.EnableUsB); - } - - if (PropertiesConfig.OrWhenVacatedState != null) - { - SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState); - } - - if (PropertiesConfig.AndWhenVacatedState != null) - { - SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState); - } - - // TODO [ ] feature/cenoodtcpoe-sensor-sensitivity-configuration - if (PropertiesConfig.UsSensitivityOccupied != null) - { - SetUsSensitivityOccupied((ushort)PropertiesConfig.UsSensitivityOccupied); - } - - if (PropertiesConfig.UsSensitivityVacant != null) - { - SetUsSensitivityVacant((ushort)PropertiesConfig.UsSensitivityVacant); - } - - if (PropertiesConfig.PirSensitivityOccupied != null) - { - SetPirSensitivityOccupied((ushort)PropertiesConfig.PirSensitivityOccupied); - } - - if (PropertiesConfig.PirSensitivityVacant != null) - { - SetPirSensitivityVacant((ushort)PropertiesConfig.PirSensitivityVacant); - } - } - - /// - /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. - /// - /// - /// - protected virtual void OccSensor_CenOccupancySensorChange(object device, GenericEventArgs args) - { - if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) - PirSensorEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) - LedFlashEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) - ShortTimeoutEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) - PirSensitivityInOccupiedStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) - PirSensitivityInVacantStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId) - RawOccupancyPirFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) - RawOccupancyUsFeedback.FireUpdate(); - } - - protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - Debug.Console(2, this, "PoEOccupancySensorChange EventId: {0}", args.EventId); - - if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId - || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) - { - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); - } - else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) - CurrentTimeoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) - RemoteTimeoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) - GraceOccupancyDetectedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) - RawOccupancyFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) - InternalPhotoSensorValue.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) - ExternalPhotoSensorValue.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId) - AndWhenVacatedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId) - OrWhenVacatedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsAEnabledFeedbackEventId) - UltrasonicAEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsBEnabledFeedbackEventId) - UltrasonicBEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) - UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) - UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - - /// - /// Sets the identity mode on or off - /// - /// - public void SetIdentityMode(bool state) - { - if (state) - OccSensor.IdentityModeOn(); - else - OccSensor.IdentityModeOff(); - - Debug.Console(1, this, "Identity Mode: {0}", OccSensor.IdentityModeOnFeedback.BoolValue ? "On" : "Off"); - } - - /// - /// Enables or disables the PIR sensor - /// - /// - public void SetPirEnable(bool state) - { - if (state) - { - OccSensor.EnablePassiveInfraredSensor(); - } - else - { - OccSensor.DisablePassiveInfraredSensor(); - } - } - - /// - /// Enables or disables the LED Flash - /// - /// - public void SetLedFlashEnable(bool state) - { - if (state) - { - OccSensor.EnableLedFlash(); - } - else - { - OccSensor.DisableLedFlash(); - } - } - - /// - /// Enables or disables short timeout based on state - /// - /// - public void SetShortTimeoutState(bool state) - { - if (state) - { - OccSensor.EnableShortTimeout(); - } - else - { - OccSensor.DisableShortTimeout(); - } - } - - public void IncrementPirSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 3) - { - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback + 1; - } - } - - public void DecrementPirSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback != 0) - { - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback - 1; - } - } - - public void IncrementPirSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 3) - { - OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback + 1; - } - } - - public void DecrementPirSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback != 0) - { - OccSensor.PassiveInfraredSensorSensitivityInVacantState = OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback - 1; - } - } - - public void IncrementUsSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 3) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback == 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = 0; - } - } - - public void DecrementUsSensitivityInOccupiedState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 0 - && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 4) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback > 3 - && (int)OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback < 7) - { - OccSensor.UltrasonicSensorSensitivityInOccupiedState = OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback + 1; - } - } - - public void IncrementUsSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 3) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback == 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = 0; - } - } - - public void DecrementUsSensitivityInVacantState(bool pressRelease) - { - if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 0 - && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 4) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback - 1; - } - else if ((int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback > 3 - && (int)OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback < 7) - { - OccSensor.UltrasonicSensorSensitivityInVacantState = OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback + 1; - } - } - - public void ForceOccupied() - { - OccSensor.ForceOccupied(); - } - - public void ForceVacant() - { - OccSensor.ForceVacant(); - } - - public void EnableRawStates(bool state) - { - if (state) - { - OccSensor.EnableRawStates(); - } - else - OccSensor.DisableRawStates(); - } - - public void SetRemoteTimeout(ushort time) - { - OccSensor.RemoteTimeout.UShortValue = time; - } - - public void SetInternalPhotoSensorMinChange(ushort value) - { - OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; - } - - /// - /// Sets the OrWhenVacated state - /// - /// - public void SetOrWhenVacatedState(bool state) - { - if (state) - { - OccSensor.OrWhenVacated(); - } - } - - /// - /// Sets the AndWhenVacated state - /// - /// - public void SetAndWhenVacatedState(bool state) - { - if (state) - { - OccSensor.AndWhenVacated(); - } - } - - /// - /// Enables or disables the Ultrasonic A sensor - /// - /// - public void SetUsAEnable(bool state) - { - if (state) - { - OccSensor.EnableUltrasonicSensorSideA(); - } - else - { - OccSensor.DisableUltrasonicSensorSideA(); - } - } - - - /// - /// Enables or disables the Ultrasonic B sensor - /// - /// - public void SetUsBEnable(bool state) - { - if (state) - { - OccSensor.EnableUltrasonicSensorSideB(); - } - else - { - OccSensor.DisableUltrasonicSensorSideB(); - } - } - - /// - /// Sets the US sensor sensitivity for occupied state - /// - /// - public void SetUsSensitivityOccupied(ushort sensitivity) - { - var level = (eSensitivityLevel) sensitivity; - if (level == 0) return; - - OccSensor.UltrasonicSensorSensitivityInOccupiedState = level; - } - - /// - /// Sets the US sensor sensitivity for vacant state - /// - /// - public void SetUsSensitivityVacant(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.UltrasonicSensorSensitivityInVacantState = level; - } - - /// - /// Sets the PIR sensor sensitivity for occupied state - /// - /// - public void SetPirSensitivityOccupied(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.PassiveInfraredSensorSensitivityInOccupiedState = level; - } - - /// - /// Sets the PIR sensor sensitivity for vacant state - /// - /// - public void SetPirSensitivityVacant(ushort sensitivity) - { - var level = (eSensitivityLevel)sensitivity; - if (level == 0) return; - - OccSensor.PassiveInfraredSensorSensitivityInVacantState = level; - } - - /// - /// Method to print current settings to console - /// - public void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Vacancy Detected: {0}", - OccSensor.VacancyDetectedFeedback.BoolValue); - - Debug.Console(0, Key, "Timeout Current: {0} | Remote: {1}", - OccSensor.CurrentTimeoutFeedback.UShortValue, - OccSensor.RemoteTimeout.UShortValue); - - Debug.Console(0, Key, "Short Timeout Enabled: {0}", - OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - Debug.Console(0, Key, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}", - OccSensor.PassiveInfraredSensorEnabledFeedback.BoolValue, - OccSensor.PassiveInfraredSensorSensitivityInOccupiedStateFeedback, - OccSensor.PassiveInfraredSensorSensitivityInVacantStateFeedback); - - Debug.Console(0, Key, "Ultrasonic Enabled A: {0} | B: {1}", - OccSensor.UltrasonicSensorSideAEnabledFeedback.BoolValue, - OccSensor.UltrasonicSensorSideBEnabledFeedback.BoolValue); - - Debug.Console(0, Key, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}", - OccSensor.UltrasonicSensorSensitivityInOccupiedStateFeedback, - OccSensor.UltrasonicSensorSensitivityInVacantStateFeedback); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - protected void LinkOccSensorToApi(CenOdtOccupancySensorBaseController occController, - BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - CenOdtOccupancySensorBaseJoinMap joinMap = new CenOdtOccupancySensorBaseJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.Online.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - - trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => - { - if (args.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - } - } - ); - - // Occupied status - trilist.SetSigTrueAction(joinMap.ForceOccupied.JoinNumber, new Action(() => occController.ForceOccupied())); - trilist.SetSigTrueAction(joinMap.ForceVacant.JoinNumber, new Action(() => occController.ForceVacant())); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); - trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, new Action((b) => occController.EnableRawStates(b))); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, new Action((u) => occController.SetRemoteTimeout(u))); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); - occController.RemoteTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, new Action(() => occController.SetLedFlashEnable(false))); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(true))); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, new Action(() => occController.SetShortTimeoutState(false))); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, new Action(() => occController.SetPirEnable(true))); - trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, new Action(() => occController.SetPirEnable(false))); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); - - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, new Action((b) => occController.SetOrWhenVacatedState(b))); - occController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, new Action((b) => occController.SetAndWhenVacatedState(b))); - occController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, new Action(() => occController.SetUsAEnable(false))); - occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, new Action(() => occController.SetUsBEnable(false))); - occController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInOccupiedState(b))); - occController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, new Action((b) => occController.IncrementUsSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, new Action((b) => occController.DecrementUsSensitivityInVacantState(b))); - occController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - - //Sensor Raw States - occController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); - occController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); - - // Identity mode - trilist.SetBoolSigAction(joinMap.IdentityMode.JoinNumber, occController.SetIdentityMode); - occController.IdentityModeFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IdentityModeFeedback.JoinNumber]); - } - - public class CenOdtOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public CenOdtOccupancySensorBaseControllerFactory() - { - TypeNames = new List() { "cenodtcpoe", "cenodtocc" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - var typeName = dc.Type.ToLower(); - var key = dc.Key; - var name = dc.Name; - var comm = CommFactory.GetControlPropertiesConfig(dc); - - var props = dc.Properties.ToObject(); - - var occSensor = new CenOdtCPoe(comm.IpIdInt, Global.ControlSystem); - - if (occSensor == null) - { - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - return null; - } - - return new CenOdtOccupancySensorBaseController(key, name, occSensor, props); - } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig b/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig deleted file mode 100644 index f65e1b37..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/EssentialsGlsOccupancySensorBaseController.cs.orig +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.GeneralIO; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common.Occupancy -{ - public class EssentialsGlsOccupancySensorBaseController : CrestronGenericBaseDevice, IOccupancyStatusProvider - { - public GlsOccupancySensorBase OccSensor { get; private set; } - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - -<<<<<<< HEAD - /// - /// Set by debugging functions - /// - public bool InMockMode { get; private set; } - - public bool MockRoomIsOccupiedFeedback { get; private set; } -======= - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } ->>>>>>> origin/feature/ecs-342-neil - - public Func RoomIsOccupiedFeedbackFunc - { - get - { -<<<<<<< HEAD - return () => InMockMode ? MockRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; -======= - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; ->>>>>>> origin/feature/ecs-342-neil - } - } - - public EssentialsGlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor, GlsOccupancySensorConfigurationProperties props) - : base(key, name, sensor) - { - OccSensor = sensor; - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange); - } - - void sensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - RoomIsOccupiedFeedback.FireUpdate(); - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - } - - /// - /// - /// - public class GlsOccupancySensorConfigurationProperties - { - public string CresnetId { get; set; } - public string Model { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs deleted file mode 100644 index 013af926..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorBaseController.cs +++ /dev/null @@ -1,541 +0,0 @@ -extern alias Full; - -using System; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Single Technology GLS Occupancy Sensors")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0}")] - public abstract class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider - { - public GlsOccupancySensorPropertiesConfig PropertiesConfig { get; private set; } - - protected GlsOccupancySensorBase OccSensor; - - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } - - public BoolFeedback GraceOccupancyDetectedFeedback { get; private set; } - - public BoolFeedback RawOccupancyFeedback { get; private set; } - - public BoolFeedback PirSensorEnabledFeedback { get; private set; } - - public BoolFeedback LedFlashEnabledFeedback { get; private set; } - - public BoolFeedback ShortTimeoutEnabledFeedback { get; private set; } - - public IntFeedback PirSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback PirSensitivityInOccupiedStateFeedback { get; private set; } - - public IntFeedback CurrentTimeoutFeedback { get; private set; } - - public IntFeedback LocalTimoutFeedback { get; private set; } - - public IntFeedback InternalPhotoSensorValue { get; set; } - - public IntFeedback ExternalPhotoSensorValue { get; set; } - - // Debug properties - public bool InTestMode { get; private set; } - - public bool TestRoomIsOccupiedFeedback { get; private set; } - - public Func RoomIsOccupiedFeedbackFunc - { - get - { - return () => InTestMode ? TestRoomIsOccupiedFeedback : OccSensor.OccupancyDetectedFeedback.BoolValue; - } - } - - protected GlsOccupancySensorBaseController(string key, DeviceConfig config) - : this(key, config.Name, config) - { - } - - protected GlsOccupancySensorBaseController(string key, string name, DeviceConfig config) - : base(key, name) - { - - var props = config.Properties.ToObject(); - - if (props != null) - { - PropertiesConfig = props; - } - else - { - Debug.Console(1, this, "props are null. Unable to deserialize into GlsOccupancySensorPropertiesConfig"); - } - - AddPostActivationAction(() => - { - OccSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (OccSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - - } - }); - } - - - /// - /// Applies any sensor settings defined in config - /// - protected virtual void ApplySettingsToSensorFromConfig() - { - Debug.Console(1, this, "Attempting to apply settings to sensor from config"); - - if (PropertiesConfig.EnablePir != null) - { - Debug.Console(1, this, "EnablePir found, attempting to set value from config"); - SetPirEnable((bool)PropertiesConfig.EnablePir); - } - else - { - Debug.Console(1, this, "EnablePir null, no value specified in config"); - } - - if (PropertiesConfig.EnableLedFlash != null) - { - Debug.Console(1, this, "EnableLedFlash found, attempting to set value from config"); - SetLedFlashEnable((bool)PropertiesConfig.EnableLedFlash); - } - - if (PropertiesConfig.RemoteTimeout != null) - { - Debug.Console(1, this, "RemoteTimeout found, attempting to set value from config"); - SetRemoteTimeout((ushort)PropertiesConfig.RemoteTimeout); - } - else - { - Debug.Console(1, this, "RemoteTimeout null, no value specified in config"); - } - - if (PropertiesConfig.ShortTimeoutState != null) - { - SetShortTimeoutState((bool)PropertiesConfig.ShortTimeoutState); - } - - if (PropertiesConfig.EnableRawStates != null) - { - EnableRawStates((bool)PropertiesConfig.EnableRawStates); - } - - if (PropertiesConfig.InternalPhotoSensorMinChange != null) - { - SetInternalPhotoSensorMinChange((ushort)PropertiesConfig.InternalPhotoSensorMinChange); - } - - if (PropertiesConfig.ExternalPhotoSensorMinChange != null) - { - SetExternalPhotoSensorMinChange((ushort)PropertiesConfig.ExternalPhotoSensorMinChange); - } - } - - protected void RegisterGlsOccupancySensorBaseController(GlsOccupancySensorBase occSensor) - { - OccSensor = occSensor; - - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); - - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - PirSensitivityInVacantStateFeedback = - new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - - PirSensitivityInOccupiedStateFeedback = - new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); - - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - - LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); - - GraceOccupancyDetectedFeedback = - new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); - - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - - ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); - - OccSensor.BaseEvent += OccSensor_BaseEvent; - - OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange; - } - - - /// - /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. - /// - /// - /// - protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.PirEnabledFeedbackEventId: - PirSensorEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId: - LedFlashEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId: - ShortTimeoutEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId: - PirSensitivityInOccupiedStateFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId: - PirSensitivityInVacantStateFeedback.FireUpdate(); - break; - } - } - - protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId); - - switch (args.EventId) - { - case GlsOccupancySensorBase.RoomVacantFeedbackEventId: - case GlsOccupancySensorBase.RoomOccupiedFeedbackEventId: - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.TimeoutFeedbackEventId: - CurrentTimeoutFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId: - LocalTimoutFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId: - GraceOccupancyDetectedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.RawOccupancyFeedbackEventId: - RawOccupancyFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId: - InternalPhotoSensorValue.FireUpdate(); - break; - case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId: - ExternalPhotoSensorValue.FireUpdate(); - break; - } - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - - Debug.Console(1, this, "In Mock Mode: '{0}'", InTestMode); - } - - public void SetTestOccupiedState(bool state) - { - if (!InTestMode) - Debug.Console(1, "Mock mode not enabled"); - else - { - TestRoomIsOccupiedFeedback = state; - - RoomIsOccupiedFeedback.FireUpdate(); - } - } - - /// - /// Enables or disables the PIR sensor - /// - /// - public void SetPirEnable(bool state) - { - Debug.Console(1, this, "Setting EnablePir to: {0}", state); - - OccSensor.EnablePir.BoolValue = state; - OccSensor.DisablePir.BoolValue = !state; - } - - /// - /// Enables or disables the LED Flash - /// - /// - public void SetLedFlashEnable(bool state) - { - OccSensor.EnableLedFlash.BoolValue = state; - OccSensor.DisableLedFlash.BoolValue = !state; - } - - /// - /// Enables or disables short timeout based on state - /// - /// - public void SetShortTimeoutState(bool state) - { - OccSensor.EnableShortTimeout.BoolValue = state; - OccSensor.DisableShortTimeout.BoolValue = !state; - } - - public void IncrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInOccupiedState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void IncrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.IncrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - public void DecrementPirSensitivityInVacantState(bool pressRelease) - { - OccSensor.DecrementPirSensitivityInVacantState.BoolValue = pressRelease; - } - - /// - /// Pulse ForceOccupied on the sensor for .5 seconds - /// - public void ForceOccupied() - { - CrestronInvoke.BeginInvoke((o) => - { - ForceOccupied(true); - CrestronEnvironment.Sleep(500); - ForceOccupied(false); - }); - } - - public void ForceOccupied(bool value) - { - OccSensor.ForceOccupied.BoolValue = value; - } - - /// - /// Pulse ForceVacant on the sensor for .5 seconds - /// - public void ForceVacant() - { - CrestronInvoke.BeginInvoke((o) => - { - ForceVacant(true); - CrestronEnvironment.Sleep(500); - ForceVacant(false); - }); - } - - public void ForceVacant(bool value) - { - OccSensor.ForceVacant.BoolValue = value; - } - - public void EnableRawStates(bool state) - { - OccSensor.EnableRawStates.BoolValue = state; - } - - public void SetRemoteTimeout(ushort time) - { - Debug.Console(1, this, "Setting RemoteTimout to: {0}", time); - - OccSensor.RemoteTimeout.UShortValue = time; - } - - public void SetInternalPhotoSensorMinChange(ushort value) - { - OccSensor.InternalPhotoSensorMinimumChange.UShortValue = value; - } - - public void SetExternalPhotoSensorMinChange(ushort value) - { - OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; - } - - /// - /// Method to print current occ settings to console. - /// - public virtual void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Vacancy Detected: {0}", - OccSensor.VacancyDetectedFeedback.BoolValue); - - Debug.Console(0, this, "Timeout Current: {0} | Local: {1}", - OccSensor.CurrentTimeoutFeedback.UShortValue, - OccSensor.LocalTimeoutFeedback.UShortValue); - - Debug.Console(0, this, "Short Timeout Enabled: {0}", - OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - - Debug.Console(0, this, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}", - OccSensor.PirEnabledFeedback.BoolValue, - OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue, - OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GlsOccupancySensorBaseJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); - } - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - - trilist.OnlineStatusChange += (d, args) => - { - if (args.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = occController.Name; - } - }; - - LinkSingleTechSensorToApi(occController, trilist, joinMap); - - LinkDualTechSensorToApi(occController, trilist, joinMap); - } - - private static void LinkDualTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - GlsOccupancySensorBaseJoinMap joinMap) - { - var odtOccController = occController as GlsOdtOccupancySensorController; - - if (odtOccController == null) - { - return; - } - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated.JoinNumber, odtOccController.SetOrWhenVacatedState); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated.JoinNumber]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated.JoinNumber, odtOccController.SetAndWhenVacatedState); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated.JoinNumber]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA.JoinNumber, () => odtOccController.SetUsAEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsA.JoinNumber, () => odtOccController.SetUsAEnable(false)); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA.JoinNumber]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB.JoinNumber, () => odtOccController.SetUsBEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableUsB.JoinNumber, () => odtOccController.SetUsBEnable(false)); - odtOccController.UltrasonicBEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB.JoinNumber]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState.JoinNumber, - odtOccController.IncrementUsSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState.JoinNumber, - odtOccController.DecrementUsSensitivityInOccupiedState); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.UsSensitivityInOccupiedState.JoinNumber]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState.JoinNumber, - odtOccController.IncrementUsSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState.JoinNumber, - odtOccController.DecrementUsSensitivityInVacantState); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.UsSensitivityInVacantState.JoinNumber]); - - //Sensor Raw States - odtOccController.RawOccupancyPirFeedback.LinkInputSig( - trilist.BooleanInput[joinMap.RawOccupancyPirFeedback.JoinNumber]); - odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback.JoinNumber]); - } - - private static void LinkSingleTechSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, - GlsOccupancySensorBaseJoinMap joinMap) - { -// Occupied status - trilist.SetBoolSigAction(joinMap.ForceOccupied.JoinNumber, occController.ForceOccupied); - trilist.SetBoolSigAction(joinMap.ForceVacant.JoinNumber, occController.ForceVacant); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback.JoinNumber]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig( - trilist.BooleanInput[joinMap.RoomVacantFeedback.JoinNumber]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback.JoinNumber]); - trilist.SetBoolSigAction(joinMap.EnableRawStates.JoinNumber, occController.EnableRawStates); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout.JoinNumber, occController.SetRemoteTimeout); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout.JoinNumber]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback.JoinNumber]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(true)); - trilist.SetSigTrueAction(joinMap.DisableLedFlash.JoinNumber, () => occController.SetLedFlashEnable(false)); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash.JoinNumber]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(true)); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout.JoinNumber, () => occController.SetShortTimeoutState(false)); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout.JoinNumber]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir.JoinNumber, () => occController.SetPirEnable(true)); - trilist.SetSigTrueAction(joinMap.DisablePir.JoinNumber, () => occController.SetPirEnable(false)); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir.JoinNumber]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState.JoinNumber, - occController.IncrementPirSensitivityInOccupiedState); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState.JoinNumber, - occController.DecrementPirSensitivityInOccupiedState); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.PirSensitivityInOccupiedState.JoinNumber]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState.JoinNumber, - occController.IncrementPirSensitivityInVacantState); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState.JoinNumber, - occController.DecrementPirSensitivityInVacantState); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig( - trilist.UShortInput[joinMap.PirSensitivityInVacantState.JoinNumber]); - } - } - - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs deleted file mode 100644 index 958edaf8..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOccupancySensorPropertiesConfig.cs +++ /dev/null @@ -1,83 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - /// - /// Defines configuration properties for Crestron GLS series occupancy sensors - /// - public class GlsOccupancySensorPropertiesConfig - { - // Single Technology Sensors (PIR): GlsOccupancySensorBase - [JsonProperty("enablePir")] - public bool? EnablePir { get; set; } - - [JsonProperty("enableLedFlash")] - public bool? EnableLedFlash { get; set; } - - [JsonProperty("shortTimeoutState")] - public bool? ShortTimeoutState { get; set; } - - [JsonProperty("enableRawStates")] - public bool? EnableRawStates { get; set; } - - [JsonProperty("remoteTimeout")] - public ushort? RemoteTimeout { get; set; } - - [JsonProperty("internalPhotoSensorMinChange")] - public ushort? InternalPhotoSensorMinChange { get; set; } - - [JsonProperty("externalPhotoSensorMinChange")] - public ushort? ExternalPhotoSensorMinChange { get; set; } - - // Dual Technology Sensors: GlsOdtCCn - [JsonProperty("enableUsA")] - public bool? EnableUsA { get; set; } - - [JsonProperty("enableUsB")] - public bool? EnableUsB { get; set; } - - [JsonProperty("orWhenVacatedState")] - public bool? OrWhenVacatedState { get; set; } - - [JsonProperty("andWhenVacatedState")] - public bool? AndWhenVacatedState { get; set; } - - // PoE Sensors: CenOdtCPoe - - /// - /// Sets the sensitivity level for US while sensor is in occupied state - /// 1 = low; 2 = medium; 3 = high; 4 = xlow; 5 = 2xlow; 6 = 3xlow - /// - [JsonProperty("usSensitivityOccupied")] - public ushort? UsSensitivityOccupied { get; set; } - - /// - /// Sets the sensitivity level for US while sensor is in vacant state - /// 1 = low; 2 = medium; 3 = high; 4 = xlow; 5 = 2xlow; 6 = 3xlow - /// - [JsonProperty("usSensitivityVacant")] - public ushort? UsSensitivityVacant { get; set; } - - /// - /// Sets the sensitivity level for PIR while sensor is in occupied state - /// 1 = low; 2 = medium; 3 = high - /// - [JsonProperty("pirSensitivityOccupied")] - public ushort? PirSensitivityOccupied { get; set; } - - /// - /// Sets the sensitivity level for PIR while sensor is in vacant state - /// 1 = low; 2 = medium; 3 = high - /// - [JsonProperty("pirSensitivityVacant")] - public ushort? PirSensitivityVacant { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs deleted file mode 100644 index dd6b3605..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOdtOccupancySensorController.cs +++ /dev/null @@ -1,284 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for Dual Technology GLS Occupancy Sensors")] - [ConfigSnippet("\"properties\": {\"control\": {\"method\": \"cresnet\",\"cresnetId\": \"97\"},\"enablePir\": true,\"enableLedFlash\": true,\"enableRawStates\":true,\"remoteTimeout\": 30,\"internalPhotoSensorMinChange\": 0,\"externalPhotoSensorMinChange\": 0,\"enableUsA\": true,\"enableUsB\": true,\"orWhenVacatedState\": true}")] - public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController - { - private GlsOdtCCn _occSensor; - - public BoolFeedback OrWhenVacatedFeedback { get; private set; } - - public BoolFeedback AndWhenVacatedFeedback { get; private set; } - - public BoolFeedback UltrasonicAEnabledFeedback { get; private set; } - - public BoolFeedback UltrasonicBEnabledFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { get; private set; } - - public BoolFeedback RawOccupancyPirFeedback { get; private set; } - - public BoolFeedback RawOccupancyUsFeedback { get; private set; } - - - public GlsOdtOccupancySensorController(string key, Func preActivationFunc, - DeviceConfig config) - : base(key, config.Name, config) - { - AddPreActivationAction(() => - { - _occSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_occSensor); - - RegisterGlsOccupancySensorBaseController(_occSensor); - - AndWhenVacatedFeedback = new BoolFeedback(() => _occSensor.AndWhenVacatedFeedback.BoolValue); - - OrWhenVacatedFeedback = new BoolFeedback(() => _occSensor.OrWhenVacatedFeedback.BoolValue); - - UltrasonicAEnabledFeedback = new BoolFeedback(() => _occSensor.UsAEnabledFeedback.BoolValue); - - UltrasonicBEnabledFeedback = new BoolFeedback(() => _occSensor.UsBEnabledFeedback.BoolValue); - - RawOccupancyPirFeedback = new BoolFeedback(() => _occSensor.RawOccupancyPirFeedback.BoolValue); - - RawOccupancyUsFeedback = new BoolFeedback(() => _occSensor.RawOccupancyUsFeedback.BoolValue); - - UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInVacantStateFeedback.UShortValue); - - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); - - }); - } - - protected override void ApplySettingsToSensorFromConfig() - { - base.ApplySettingsToSensorFromConfig(); - - if (PropertiesConfig.EnableUsA != null) - { - Debug.Console(1, this, "EnableUsA found, attempting to set value from config"); - SetUsAEnable((bool)PropertiesConfig.EnableUsA); - } - else - { - Debug.Console(1, this, "EnableUsA null, no value specified in config"); - } - - - if (PropertiesConfig.EnableUsB != null) - { - Debug.Console(1, this, "EnableUsB found, attempting to set value from config"); - SetUsBEnable((bool)PropertiesConfig.EnableUsB); - } - else - { - Debug.Console(1, this, "EnablePir null, no value specified in config"); - } - - - if (PropertiesConfig.OrWhenVacatedState != null) - { - SetOrWhenVacatedState((bool)PropertiesConfig.OrWhenVacatedState); - } - - if (PropertiesConfig.AndWhenVacatedState != null) - { - SetAndWhenVacatedState((bool)PropertiesConfig.AndWhenVacatedState); - } - } - - /// - /// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class. - /// Then calls the base delegate method to ensure any common event IDs are captured. - /// - /// - /// - protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.AndWhenVacatedFeedbackEventId: - AndWhenVacatedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.OrWhenVacatedFeedbackEventId: - OrWhenVacatedFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsAEnabledFeedbackEventId: - UltrasonicAEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsBEnabledFeedbackEventId: - UltrasonicBEnabledFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId: - UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId: - UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); - break; - } - - base.OccSensor_GlsOccupancySensorChange(device, args); - } - - /// - /// Overrides the base class event delegate to fire feedbacks for event IDs that pertain to this extended class. - /// Then calls the base delegate method to ensure any common event IDs are captured. - /// - /// - /// - protected override void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) - { - switch (args.EventId) - { - case GlsOccupancySensorBase.RawOccupancyPirFeedbackEventId: - RawOccupancyPirFeedback.FireUpdate(); - break; - case GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId: - RawOccupancyUsFeedback.FireUpdate(); - break; - } - - base.OccSensor_BaseEvent(device, args); - } - - /// - /// Sets the OrWhenVacated state - /// - /// - public void SetOrWhenVacatedState(bool state) - { - _occSensor.OrWhenVacated.BoolValue = state; - } - - /// - /// Sets the AndWhenVacated state - /// - /// - public void SetAndWhenVacatedState(bool state) - { - _occSensor.AndWhenVacated.BoolValue = state; - } - - /// - /// Enables or disables the Ultrasonic A sensor - /// - /// - public void SetUsAEnable(bool state) - { - _occSensor.EnableUsA.BoolValue = state; - _occSensor.DisableUsA.BoolValue = !state; - } - - - /// - /// Enables or disables the Ultrasonic B sensor - /// - /// - public void SetUsBEnable(bool state) - { - _occSensor.EnableUsB.BoolValue = state; - _occSensor.DisableUsB.BoolValue = !state; - } - - public void IncrementUsSensitivityInOccupiedState(bool pressRelease) - { - _occSensor.IncrementUsSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void DecrementUsSensitivityInOccupiedState(bool pressRelease) - { - _occSensor.DecrementUsSensitivityInOccupiedState.BoolValue = pressRelease; - } - - public void IncrementUsSensitivityInVacantState(bool pressRelease) - { - _occSensor.IncrementUsSensitivityInVacantState.BoolValue = pressRelease; - } - - public void DecrementUsSensitivityInVacantState(bool pressRelease) - { - _occSensor.DecrementUsSensitivityInVacantState.BoolValue = pressRelease; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - /// - /// Method to print occ sensor settings to console. - /// - public override void GetSettings() - { - base.GetSettings(); - - Debug.Console(0, this, "Ultrasonic Enabled A: {0} | B: {1}", - _occSensor.UsAEnabledFeedback.BoolValue, - _occSensor.UsBEnabledFeedback.BoolValue); - - Debug.Console(0, this, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}", - _occSensor.UsSensitivityInOccupiedStateFeedback.UShortValue, - _occSensor.UsSensitivityInVacantStateFeedback.UShortValue); - - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - } - - public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory - { - public GlsOdtOccupancySensorControllerFactory() - { - TypeNames = new List { "glsodtccn" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc); - } - - private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = String.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey); - return new GlsOdtCCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn", parentKey); - return new GlsOdtCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - } - - - -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs b/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs deleted file mode 100644 index 573d94ac..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/GlsOirOccupancySensorController.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - public class GlsOirOccupancySensorController:GlsOccupancySensorBaseController - { - private GlsOirCCn _occSensor; - - public GlsOirOccupancySensorController(string key, Func preActivationFunc,DeviceConfig config) : this(key,config.Name, preActivationFunc, config) - { - } - - public GlsOirOccupancySensorController(string key, string name, Func preActivationFunc, DeviceConfig config) : base(key, name, config) - { - AddPreActivationAction(() => - { - _occSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_occSensor); - - RegisterGlsOccupancySensorBaseController(_occSensor); - }); - } - - #region Overrides of CrestronGenericBridgeableBaseDevice - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); - } - - #endregion - } - - public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public GlsOccupancySensorBaseControllerFactory() - { - TypeNames = new List { "glsoirccn" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOirOccupancySensorController Device"); - - return new GlsOirOccupancySensorController(dc.Key, GetGlsOirCCn, dc); - } - - private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey); - return new GlsOirCCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn", parentKey); - return new GlsOirCCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs b/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs deleted file mode 100644 index dfa4fef1..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/IOccupancyStatusProviderAggregator.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.GeneralIO; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core -{ - /// - /// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects - /// - public class IOccupancyStatusProviderAggregator : EssentialsDevice, IOccupancyStatusProvider - { - /// - /// Aggregated feedback of all linked IOccupancyStatusProvider devices - /// - public BoolFeedback RoomIsOccupiedFeedback - { - get - { - return _aggregatedOccupancyStatus.Output; - } - } - - private readonly BoolFeedbackOr _aggregatedOccupancyStatus; - - public IOccupancyStatusProviderAggregator(string key, string name) - : base(key, name) - { - _aggregatedOccupancyStatus = new BoolFeedbackOr(); - } - - public IOccupancyStatusProviderAggregator(string key, string name, OccupancyAggregatorConfig config) - : this(key, name) - { - AddPostActivationAction(() => - { - if (config.DeviceKeys.Count == 0) - { - return; - } - - foreach (var deviceKey in config.DeviceKeys) - { - var device = DeviceManager.GetDeviceForKey(deviceKey); - - if (device == null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, - "Unable to retrieve Occupancy provider with key {0}", deviceKey); - continue; - } - - var provider = device as IOccupancyStatusProvider; - - if (provider == null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, - "Device with key {0} does NOT implement IOccupancyStatusProvider. Please check configuration."); - continue; - } - - AddOccupancyStatusProvider(provider); - } - }); - } - - /// - /// Adds an IOccupancyStatusProvider device - /// - /// - public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider) - { - _aggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback); - } - - public void RemoveOccupancyStatusProvider(IOccupancyStatusProvider statusProvider) - { - _aggregatedOccupancyStatus.RemoveOutputIn(statusProvider.RoomIsOccupiedFeedback); - } - - public void ClearOccupancyStatusProviders() - { - _aggregatedOccupancyStatus.ClearOutputs(); - } - } - - public class OccupancyAggregatorFactory : EssentialsDeviceFactory - { - public OccupancyAggregatorFactory() - { - TypeNames = new List { "occupancyAggregator", "occAggregate" }; - } - - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - - var config = dc.Properties.ToObject(); - - return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs b/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs deleted file mode 100644 index 884ebfdd..00000000 --- a/src/PepperDash.Essentials.Core/Occupancy/OccupancyAggregatorConfig.cs +++ /dev/null @@ -1,17 +0,0 @@ -extern alias Full; - -using System.Collections.Generic; -using Full.Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - public class OccupancyAggregatorConfig - { - [JsonProperty("deviceKeys")] public List DeviceKeys { get; set; } - - public OccupancyAggregatorConfig() - { - DeviceKeys = new List(); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs deleted file mode 100644 index 511eda66..00000000 --- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorController.cs +++ /dev/null @@ -1,366 +0,0 @@ -extern alias Full; - -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Full.Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Bridges.JoinMaps; - -using System; -using System.Collections.Generic; -using PepperDash.Essentials.Core.Config; -using PepperDash_Essentials_Core.PartitionSensor; - -namespace PepperDash.Essentials.Core -{ - [Description("Wrapper class for GLS Cresnet Partition Sensor")] - public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice, IPartitionStateProvider - { - - public GlsPartitionSensorPropertiesConfig PropertiesConfig { get; private set; } - - private GlsPartCn _partitionSensor; - - public BoolFeedback EnableFeedback { get; private set; } - public BoolFeedback PartitionPresentFeedback { get; private set; } - public BoolFeedback PartitionNotSensedFeedback { get; private set; } - public IntFeedback SensitivityFeedback { get; private set; } - - public bool InTestMode { get; private set; } - public bool TestEnableFeedback { get; private set; } - public bool TestPartitionSensedFeedback { get; private set; } - public int TestSensitivityFeedback { get; private set; } - - - public GlsPartitionSensorController(string key, Func preActivationFunc, DeviceConfig config) - : base(key, config.Name) - { - - var props = config.Properties.ToObject(); - if (props != null) - { - PropertiesConfig = props; - } - else - { - Debug.Console(1, this, "props are null. Unable to deserialize into GlsPartSensorPropertiesConfig"); - } - - AddPreActivationAction(() => - { - _partitionSensor = preActivationFunc(config); - - RegisterCrestronGenericBase(_partitionSensor); - - EnableFeedback = new BoolFeedback(() => InTestMode ? TestEnableFeedback : _partitionSensor.EnableFeedback.BoolValue); - PartitionPresentFeedback = new BoolFeedback(() => InTestMode ? TestPartitionSensedFeedback : _partitionSensor.PartitionSensedFeedback.BoolValue); - PartitionNotSensedFeedback = new BoolFeedback(() => InTestMode ? !TestPartitionSensedFeedback : _partitionSensor.PartitionNotSensedFeedback.BoolValue); - SensitivityFeedback = new IntFeedback(() => InTestMode ? TestSensitivityFeedback : _partitionSensor.SensitivityFeedback.UShortValue); - - if (_partitionSensor != null) - { - _partitionSensor.BaseEvent += PartitionSensor_BaseEvent; - } - }); - - AddPostActivationAction(() => - { - _partitionSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - ApplySettingsToSensorFromConfig(); - } - }; - - if (_partitionSensor.IsOnline) - { - ApplySettingsToSensorFromConfig(); - } - }); - } - - private void ApplySettingsToSensorFromConfig() - { - if (_partitionSensor.IsOnline == false) return; - - // Default to enable - _partitionSensor.Enable.BoolValue = true; - - Debug.Console(1, this, "Attempting to apply settings to sensor from config"); - - if (PropertiesConfig.Sensitivity != null) - { - Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config", - PropertiesConfig.Sensitivity); - _partitionSensor.Sensitivity.UShortValue = (ushort)PropertiesConfig.Sensitivity; - } - else - { - Debug.Console(1, this, "Sensitivity null, no value specified in config"); - } - - if (PropertiesConfig.Enable != null) - { - Debug.Console(1, this, "Enable found, attempting to set value '{0}' from config", - PropertiesConfig.Enable); - _partitionSensor.Enable.BoolValue = (bool)PropertiesConfig.Enable; - } - else - { - Debug.Console(1, this, "Enable null, no value specified in config"); - } - - } - - private void PartitionSensor_BaseEvent(GenericBase device, BaseEventArgs args) - { - Debug.Console(2, this, "EventId: {0}, Index: {1}", args.EventId, args.Index); - - switch (args.EventId) - { - case (GlsPartCn.EnableFeedbackEventId): - { - EnableFeedback.FireUpdate(); - break; - } - case (GlsPartCn.PartitionSensedFeedbackEventId): - { - Debug.Console(1, this, "Partition Sensed State: {0}", _partitionSensor.PartitionSensedFeedback.BoolValue); - PartitionPresentFeedback.FireUpdate(); - break; - } - case (GlsPartCn.PartitionNotSensedFeedbackEventId): - { - Debug.Console(1, this, "Partition Not Sensed State: {0}", _partitionSensor.PartitionNotSensedFeedback.BoolValue); - PartitionNotSensedFeedback.FireUpdate(); - break; - } - case (GlsPartCn.SensitivityFeedbackEventId): - { - SensitivityFeedback.FireUpdate(); - break; - } - default: - { - Debug.Console(2, this, "Unhandled args.EventId: {0}", args.EventId); - break; - } - } - } - - public void SetTestMode(bool mode) - { - InTestMode = mode; - Debug.Console(1, this, "InTestMode: {0}", InTestMode.ToString()); - } - - public void SetTestEnableState(bool state) - { - if (InTestMode) - { - TestEnableFeedback = state; - - EnableFeedback.FireUpdate(); - - Debug.Console(1, this, "TestEnableFeedback: {0}", TestEnableFeedback.ToString()); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set enable state: {1}", InTestMode.ToString(), state.ToString()); - } - - public void SetTestPartitionSensedState(bool state) - { - if (InTestMode) - { - TestPartitionSensedFeedback = state; - - PartitionPresentFeedback.FireUpdate(); - PartitionNotSensedFeedback.FireUpdate(); - - Debug.Console(1, this, "TestPartitionSensedFeedback: {0}", TestPartitionSensedFeedback.ToString()); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set partition state: {1}", InTestMode.ToString(), state.ToString()); - } - - public void SetTestSensitivityValue(int value) - { - if (InTestMode) - { - TestSensitivityFeedback = value; - - SensitivityFeedback.FireUpdate(); - Debug.Console(1, this, "TestSensitivityFeedback: {0}", TestSensitivityFeedback); - return; - } - - Debug.Console(1, this, "InTestMode: {0}, unable to set sensitivity value: {1}", InTestMode.ToString(), value); - } - - public void GetSettings() - { - var dash = new string('*', 50); - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - - Debug.Console(0, this, "Enabled State: {0}", _partitionSensor.EnableFeedback.BoolValue); - - Debug.Console(0, this, "Partition Sensed State: {0}", _partitionSensor.PartitionSensedFeedback.BoolValue); - Debug.Console(0, this, "Partition Not Sensed State: {0}", _partitionSensor.PartitionNotSensedFeedback.BoolValue); - - Debug.Console(0, this, "Sensitivity Value: {0}", _partitionSensor.SensitivityFeedback.UShortValue); - - CrestronConsole.PrintLine(string.Format("{0}\n", dash)); - } - - public void SetEnableState(bool state) - { - Debug.Console(2, this, "Sensor is {0}, SetEnableState: {1}", _partitionSensor == null ? "null" : "not null", state); - if (_partitionSensor == null) - return; - - _partitionSensor.Enable.BoolValue = state; - } - - public void IncreaseSensitivity() - { - Debug.Console(2, this, "Sensor is {0}, IncreaseSensitivity", _partitionSensor == null ? "null" : "not null"); - if (_partitionSensor == null) - return; - - _partitionSensor.IncreaseSensitivity(); - } - - public void DecreaseSensitivity() - { - Debug.Console(2, this, "Sensor is {0}, DecreaseSensitivity", _partitionSensor == null ? "null" : "not null"); - if (_partitionSensor == null) - return; - - _partitionSensor.DecreaseSensitivity(); - } - - public void SetSensitivity(ushort value) - { - Debug.Console(2, this, "Sensor is {0}, SetSensitivity: {1}", _partitionSensor == null ? "null" : "not null", value); - if (_partitionSensor == null) - return; - - _partitionSensor.Sensitivity.UShortValue = value; - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = new GlsPartitionSensorJoinMap(joinStart); - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - if (bridge != null) - { - bridge.AddJoinMap(Key, joinMap); - } - else - { - Debug.Console(0, this, "Please update config to use 'type': 'EiscApiAdvanced' to get all join map features for this device"); - } - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name); - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = _partitionSensor.Name; - - trilist.SetBoolSigAction(joinMap.Enable.JoinNumber, SetEnableState); - EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]); - - PartitionPresentFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]); - PartitionNotSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]); - - trilist.SetSigTrueAction(joinMap.IncreaseSensitivity.JoinNumber, IncreaseSensitivity); - trilist.SetSigTrueAction(joinMap.DecreaseSensitivity.JoinNumber, DecreaseSensitivity); - - SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]); - trilist.SetUShortSigAction(joinMap.Sensitivity.JoinNumber, SetSensitivity); - - FeedbacksFireUpdates(); - - // update when device is online - _partitionSensor.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - FeedbacksFireUpdates(); - } - }; - - // update when trilist is online - trilist.OnlineStatusChange += (o, a) => - { - if (a.DeviceOnLine) - { - trilist.StringInput[joinMap.Name.JoinNumber].StringValue = _partitionSensor.Name; - FeedbacksFireUpdates(); - } - }; - } - - private void FeedbacksFireUpdates() - { - IsOnline.FireUpdate(); - EnableFeedback.FireUpdate(); - PartitionPresentFeedback.FireUpdate(); - PartitionNotSensedFeedback.FireUpdate(); - SensitivityFeedback.FireUpdate(); - } - - #region PreActivation - - private static GlsPartCn GetGlsPartCnDevice(DeviceConfig dc) - { - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - var branchId = control.ControlPortNumber; - var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - - if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey); - return new GlsPartCn(cresnetId, Global.ControlSystem); - } - var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as IHasCresnetBranches; - - if (cresnetBridge != null) - { - Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsPartCn", parentKey); - return new GlsPartCn(cresnetId, cresnetBridge.CresnetBranches[branchId]); - } - Debug.Console(0, "Device {0} is not a valid cresnet master", parentKey); - return null; - } - #endregion - - - public class GlsPartitionSensorControllerFactory : EssentialsDeviceFactory - { - public GlsPartitionSensorControllerFactory() - { - TypeNames = new List { "glspartcn" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new GlsPartitionSensorController Device"); - - return new GlsPartitionSensorController(dc.Key, GetGlsPartCnDevice, dc); - } - } - - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs b/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs deleted file mode 100644 index 03611dd2..00000000 --- a/src/PepperDash.Essentials.Core/PartitionSensor/GlsPartitionSensorPropertiesConfig.cs +++ /dev/null @@ -1,26 +0,0 @@ -extern alias Full; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Full.Newtonsoft.Json; - -namespace PepperDash_Essentials_Core.PartitionSensor -{ - public class GlsPartitionSensorPropertiesConfig - { - /// - /// Sets the sensor sensitivity - /// - /// - /// The sensitivity range shall be between 1(lowest) to 10 (highest). - /// - [JsonProperty("sensitivity")] - public ushort? Sensitivity { get; set; } - - [JsonProperty("enable")] - public bool? Enable { get; set; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj index 345289eb..26cf6583 100644 --- a/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj +++ b/src/PepperDash.Essentials.Core/PepperDash.Essentials.Core.csproj @@ -1,9 +1,11 @@  ProgramLibrary + Debug;Release;Debug 4.7.2 - net472 + net472;net6 + true bin\$(Configuration)\ PepperDash.Essentials.Core PepperDash.Essentials.Core @@ -13,23 +15,17 @@ full + + full + pdbonly - - - - - - - - Full - - + + - \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs b/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs index ab59914d..78e7f7e1 100644 --- a/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs +++ b/src/PepperDash.Essentials.Core/Presets/DevicePresets.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; using PepperDash.Core; //using SSMono.IO; diff --git a/src/PepperDash.Essentials.Core/Presets/PresetBase.cs b/src/PepperDash.Essentials.Core/Presets/PresetBase.cs index 1263d231..1eaf7739 100644 --- a/src/PepperDash.Essentials.Core/Presets/PresetBase.cs +++ b/src/PepperDash.Essentials.Core/Presets/PresetBase.cs @@ -1,4 +1,4 @@ -extern alias Full; + using System; using System.Collections.Generic; @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Presets { diff --git a/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs b/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs index 203722f3..c10ba75d 100644 --- a/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs +++ b/src/PepperDash.Essentials.Core/Presets/PresetChannel.cs @@ -1,11 +1,11 @@ -extern alias Full; + using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; -using Full.Newtonsoft.Json; +using Newtonsoft.Json; namespace PepperDash.Essentials.Core.Presets { diff --git a/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs b/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs index 3c01032e..596c5921 100644 --- a/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/ComsMessage.cs @@ -62,78 +62,6 @@ namespace PepperDash.Essentials.Core.Queues } } - /// - /// Shows either the byte[] or string to be sent - /// - public override string ToString() - { - return _bytes != null ? _bytes.ToString() : _string; - } - } -} - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// IBasicCommunication Message for IQueue - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class ComsMessage : IQueueMessage - { - private readonly byte[] _bytes; - private readonly IBasicCommunication _coms; - private readonly string _string; - private readonly bool _isByteMessage; - - /// - /// Constructor for a string message - /// - /// IBasicCommunication to send the message - /// Message to send - public ComsMessage(IBasicCommunication coms, string message) - { - Validate(coms, message); - _coms = coms; - _string = message; - } - - /// - /// Constructor for a byte message - /// - /// IBasicCommunication to send the message - /// Message to send - public ComsMessage(IBasicCommunication coms, byte[] message) - { - Validate(coms, message); - _coms = coms; - _bytes = message; - _isByteMessage = true; - } - - private void Validate(IBasicCommunication coms, object message) - { - if (coms == null) - throw new ArgumentNullException("coms"); - - if (message == null) - throw new ArgumentNullException("message"); - } - - /// - /// Dispatchs the string/byte[] to the IBasicCommunication specified - /// - public void Dispatch() - { - if (_isByteMessage) - { - _coms.SendBytes(_bytes); - } - else - { - _coms.SendText(_string); - } - } - /// /// Shows either the byte[] or string to be sent /// diff --git a/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs b/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs index d4fe1af3..dc7ff0d4 100644 --- a/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs +++ b/src/PepperDash.Essentials.Core/Queues/GenericQueue.cs @@ -1,8 +1,9 @@ using System; +using System.Collections.Concurrent; +using System.Threading; using Crestron.SimplSharp; -using Crestron.SimplSharp.Reflection; -using Crestron.SimplSharpPro.CrestronThread; using PepperDash.Core; +using Thread = Crestron.SimplSharpPro.CrestronThread.Thread; namespace PepperDash.Essentials.Core.Queues { @@ -12,7 +13,7 @@ namespace PepperDash.Essentials.Core.Queues public class GenericQueue : IQueue { private readonly string _key; - protected readonly CrestronQueue _queue; + protected readonly ConcurrentQueue _queue; protected readonly Thread _worker; protected readonly CEvent _waitHandle = new CEvent(); @@ -33,7 +34,7 @@ namespace PepperDash.Essentials.Core.Queues { get { - return _queue.Size; + return int.MaxValue; } } @@ -137,7 +138,8 @@ namespace PepperDash.Essentials.Core.Queues { cap = capacity; // overrides default } - _queue = new CrestronQueue(cap); + + _queue = new ConcurrentQueue(); _worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running) { Priority = priority, @@ -170,14 +172,9 @@ namespace PepperDash.Essentials.Core.Queues { while (true) { - IQueueMessage item = null; + if (_queue.TryDequeue(out var item) && item == null) + break; - if (_queue.Count > 0) - { - item = _queue.Dequeue(); - if (item == null) - break; - } if (item != null) { try @@ -188,7 +185,7 @@ namespace PepperDash.Essentials.Core.Queues if (_delayEnabled) Thread.Sleep(_delayTime); } - catch (System.Threading.ThreadAbortException) + catch (ThreadAbortException) { //swallowing this exception, as it should only happen on shut down } @@ -244,14 +241,13 @@ namespace PepperDash.Essentials.Core.Queues if (disposing) { - Debug.Console(2, this, "Disposing..."); - if (_queue != null && !_queue.Disposed) + using (_waitHandle) { - _queue.Clear(); - Enqueue(null); + Debug.Console(2, this, "Disposing..."); + _queue.Enqueue(null); + _waitHandle.Set(); + _worker.Join(); } - _worker.Abort(); - _waitHandle.Close(); } Disposed = true; @@ -271,261 +267,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// Threadsafe processing of queued items with pacing if required - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class GenericQueue : IQueue - { - private readonly string _key; - protected readonly CrestronQueue _queue; - protected readonly Thread _worker; - protected readonly CEvent _waitHandle = new CEvent(); - - private bool _delayEnabled; - private int _delayTime; - - private const Thread.eThreadPriority _defaultPriority = Thread.eThreadPriority.MediumPriority; - - /// - /// If the instance has been disposed. - /// - public bool Disposed { get; private set; } - - /// - /// Returns the capacity of the CrestronQueue (fixed Size property) - /// - public int QueueCapacity - { - get - { - return _queue.Size; - } - } - - /// - /// Returns the number of elements currently in the CrestronQueue - /// - public int QueueCount - { - get - { - return _queue.Count; - } - } - - /// - /// Constructor with no thread priority - /// - /// - public GenericQueue(string key) - : this(key, _defaultPriority, 0, 0) - { - } - - /// - /// Constructor with queue size - /// - /// - /// Fixed size for the queue to hold - public GenericQueue(string key, int capacity) - : this(key, _defaultPriority, capacity, 0) - { - } - - /// - /// Constructor for generic queue with no pacing - /// - /// Key - /// Pacing in ms between actions - public GenericQueue(int pacing, string key) - : this(key, _defaultPriority, 0, pacing) - { - } - - /// - /// Constructor with pacing and capacity - /// - /// - /// - /// - public GenericQueue(string key, int pacing, int capacity) - : this(key, _defaultPriority, capacity, pacing) - { - } - - /// - /// Constructor with pacing and priority - /// - /// - /// - /// - public GenericQueue(string key, int pacing, Thread.eThreadPriority priority) - : this(key, priority, 0, pacing) - { - } - - /// - /// Constructor with pacing, priority and capacity - /// - /// - /// - /// - public GenericQueue(string key, Thread.eThreadPriority priority, int capacity) - : this(key, priority, capacity, 0) - { - } - - /// - /// Constructor with pacing, priority and capacity - /// - /// - /// - /// - /// - public GenericQueue(string key, int pacing, Thread.eThreadPriority priority, int capacity) - : this(key, priority, capacity, pacing) - { - } - - /// - /// Constructor for generic queue with no pacing - /// - /// Key - /// - /// - /// - protected GenericQueue(string key, Thread.eThreadPriority priority, int capacity, int pacing) - { - _key = key; - int cap = 25; // sets default - if (capacity > 0) - { - cap = capacity; // overrides default - } - _queue = new CrestronQueue(cap); - _worker = new Thread(ProcessQueue, null, Thread.eThreadStartOptions.Running) - { - Priority = priority - }; - - SetDelayValues(pacing); - } - - private void SetDelayValues(int pacing) - { - _delayEnabled = pacing > 0; - _delayTime = pacing; - - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; - - Dispose(true); - }; - } - - /// - /// Thread callback - /// - /// The action used to process dequeued items - /// Null when the thread is exited - private object ProcessQueue(object obj) - { - while (true) - { - IQueueMessage item = null; - - if (_queue.Count > 0) - { - item = _queue.Dequeue(); - if (item == null) - break; - } - if (item != null) - { - try - { - Debug.Console(2, this, "Processing queue item: '{0}'", item.ToString()); - item.Dispatch(); - - if (_delayEnabled) - Thread.Sleep(_delayTime); - } - catch (Exception ex) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}", ex.Message); - Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.StackTrace); - - if (ex.InnerException != null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Caught an exception in the Queue {0}", ex.InnerException.Message); - Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Stack Trace: {0}", ex.InnerException.StackTrace); - } - } - } - else _waitHandle.Wait(); - } - - return null; - } - - public void Enqueue(IQueueMessage item) - { - _queue.Enqueue(item); - _waitHandle.Set(); - } - - /// - /// Disposes the thread and cleans up resources. Thread cannot be restarted once - /// disposed. - /// - public void Dispose() - { - Dispose(true); - CrestronEnvironment.GC.SuppressFinalize(this); - } - - /// - /// Actually does the disposing. If you override this method, be sure to either call the base implementation - /// or clean up all the resources yourself. - /// - /// set to true unless called from finalizer - protected void Dispose(bool disposing) - { - if (Disposed) - return; - - if (disposing) - { - Debug.Console(2, this, "Disposing..."); - if (_queue != null && !_queue.Disposed) - { - _queue.Clear(); - Enqueue(null); - } - _worker.Abort(); - _waitHandle.Close(); - } - - Disposed = true; - } - - ~GenericQueue() - { - Dispose(true); - } - - /// - /// Key - /// - public string Key - { - get { return _key; } - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/IQueue.cs b/src/PepperDash.Essentials.Core/Queues/IQueue.cs index 15803330..cb3bb947 100644 --- a/src/PepperDash.Essentials.Core/Queues/IQueue.cs +++ b/src/PepperDash.Essentials.Core/Queues/IQueue.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; using PepperDash.Core; namespace PepperDash.Essentials.Core.Queues @@ -13,13 +9,3 @@ namespace PepperDash.Essentials.Core.Queues bool Disposed { get; } } } - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public interface IQueue : IKeyed, IDisposable where T : class - { - void Enqueue(T item); - bool Disposed { get; } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs b/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs index 8ffd4d96..408bffca 100644 --- a/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/IQueueMessage.cs @@ -6,13 +6,4 @@ namespace PepperDash.Essentials.Core.Queues { void Dispatch(); } -} - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public interface IQueueMessage - { - void Dispatch(); - } } \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs b/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs index d8ea4ada..5617326f 100644 --- a/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs +++ b/src/PepperDash.Essentials.Core/Queues/ProcessStringMessage.cs @@ -42,47 +42,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - /// - /// Message class for processing strings via an IQueue - /// - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public class ProcessStringMessage : IQueueMessage - { - private readonly Action _action; - private readonly string _message; - - /// - /// Constructor - /// - /// Message to be processed - /// Action to invoke on the message - public ProcessStringMessage(string message, Action action) - { - _message = message; - _action = action; - } - - /// - /// Processes the string with the given action - /// - public void Dispatch() - { - if (_action == null || String.IsNullOrEmpty(_message)) - return; - - _action(_message); - } - - /// - /// To string - /// - /// The current message - public override string ToString() - { - return _message ?? String.Empty; - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs b/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs index e2db5d72..62020af0 100644 --- a/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs +++ b/src/PepperDash.Essentials.Core/Queues/StringResponseProcessor.cs @@ -104,107 +104,3 @@ namespace PepperDash.Essentials.Core.Queues } } } - -namespace PepperDash_Essentials_Core.Queues -{ - [Obsolete("Use PepperDash.Essentials.Core.Queues")] - public sealed class StringResponseProcessor : IKeyed, IDisposable - { - private readonly Action _processStringAction; - private readonly IQueue _queue; - private readonly IBasicCommunication _coms; - private readonly CommunicationGather _gather; - - private StringResponseProcessor(string key, Action processStringAction) - { - _processStringAction = processStringAction; - _queue = new GenericQueue(key); - - CrestronEnvironment.ProgramStatusEventHandler += programEvent => - { - if (programEvent != eProgramStatusEventType.Stopping) - return; - - Dispose(); - }; - } - - /// - /// Constructor that builds an instance and subscribes to coms TextReceived for processing - /// - /// Com port to process strings from - /// Action to process the incoming strings - public StringResponseProcessor(IBasicCommunication coms, Action processStringAction) - : this(coms.Key, processStringAction) - { - _coms = coms; - coms.TextReceived += OnResponseReceived; - } - - /// - /// Constructor that builds an instance and subscribes to gather Line Received for processing - /// - /// Gather to process strings from - /// Action to process the incoming strings - public StringResponseProcessor(CommunicationGather gather, Action processStringAction) - : this(gather.Port.Key, processStringAction) - { - _gather = gather; - gather.LineReceived += OnResponseReceived; - } - - private void OnResponseReceived(object sender, GenericCommMethodReceiveTextArgs args) - { - _queue.Enqueue(new ProcessStringMessage(args.Text, _processStringAction)); - } - - /// - /// Key - /// - public string Key - { - get { return _queue.Key; } - } - - /// - /// Disposes the instance and cleans up resources. - /// - public void Dispose() - { - Dispose(true); - CrestronEnvironment.GC.SuppressFinalize(this); - } - - private void Dispose(bool disposing) - { - if (Disposed) - return; - - if (disposing) - { - if (_coms != null) - _coms.TextReceived -= OnResponseReceived; - - if (_gather != null) - { - _gather.LineReceived -= OnResponseReceived; - _gather.Stop(); - } - - _queue.Dispose(); - } - - Disposed = true; - } - - /// - /// If the instance has been disposed or not. If it has, you can not use it anymore - /// - public bool Disposed { get; private set; } - - ~StringResponseProcessor() - { - Dispose(false); - } - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs b/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs deleted file mode 100644 index 58cf7d7c..00000000 --- a/src/PepperDash.Essentials.Core/Remotes/ButtonExtensions.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; - -namespace PepperDash.Essentials.Core -{ - public static class ButtonExtensions - { - public static Button SetButtonAction(this Button button, Action a) - { - button.UserObject = a; - return button; - } - - public static Button SetButtonAction(this CrestronCollection