diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..c969d2a1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]-" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Stacktrace** + +Include a stack trace of the exception if possible. +``` +Paste stack trace here +``` + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..0a854e75 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEATURE]-" +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +If this is a request for support for a new device or type, be as specific as possible and include any pertinent manufacturer and model information. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..5fb11cc8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Build Non-Release Branch + +on: + push: + branches: + - feature/* + - bugfix/* + - hotfix/* + +jobs: + build: + name: Build + runs-on: self-hosted + steps: + - run: Invoke-WebRequest -URI "http://localhost:8080/job/Essentials%20Builds/build?token=$($Env:projectToken)" -Headers @{Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("ndorin:$($Env:token)")))"} -Method POST -UseBasicParsing + env: + token: ${{ secrets.TOKEN }} + projectToken: ${{ secrets.PROJECTTOKEN}} diff --git a/.gitmodules b/.gitmodules index bdf1f3b1..2ce66ffc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "essentials-framework/pepperdashcore-builds"] path = essentials-framework/pepperdashcore-builds - url = https://bitbucket.org/Pepperdash_Products/pepperdashcore-builds.git + url = https://github.com/ndorin/PepperDashCore-Builds.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..890b7769 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,110 @@ +# Contributors Guide + +Essentials is an open source project. If you are interested in making it better, +there are many ways you can contribute. For example, you can: + +- Submit a bug report +- Suggest a new feature +- Provide feedback by commenting on feature requests/proposals +- Propose a patch by submitting a pull request +- Suggest or submit documentation improvements +- Review outstanding pull requests +- Answer questions from other users +- Share the software with other users who are interested +- Teach others to use the software + +## Bugs and Feature Requests + +If you believe that you have found a bug or wish to propose a new feature, +please first search the existing [issues] to see if it has already been +reported. If you are unable to find an existing issue, consider using one of +the provided templates to create a new issue and provide as many details as you +can to assist in reproducing the bug or explaining your proposed feature. + +## Patch Submission tips + +Patches should be submitted in the form of Pull Requests to the Essentials +[repository] on GitHub. But first, consider the following tips to ensure a +smooth process when submitting a patch: + +- Ensure that the patch compiles and does not break any build-time tests. +- Be understanding, patient, and friendly; developers may need time to review + your submissions before they can take action or respond. This does not mean + your contribution is not valued. If your contribution has not received a + response in a reasonable time, consider commenting with a polite inquiry for + an update. +- Limit your patches to the smallest reasonable change to achieve your intended + goal. For example, do not make unnecessary indentation changes; but don't go + out of your way to make the patch so minimal that it isn't easy to read, + either. Consider the reviewer's perspective. +- Before submission, please squash your commits to using a message that starts + with the issue number and a description of the changes. +- Isolate multiple patches from each other. If you wish to make several + independent patches, do so in separate, smaller pull requests that can be + reviewed more easily. +- Be prepared to answer questions from reviewers. They may have further + questions before accepting your patch, and may even propose changes. Please + accept this feedback constructively, and not as a rejection of your proposed + change. + +## GitFlow Branch Model +This repository adheres to the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model and is intitialized for GitFlow to make for consistent branch name prefixes. Please take time to familiarize yourself with this model. + +- `master` will contain the latest stable version of the framework and release builds will be created from tagged commits on `master`. +- HotFix/Patch Pull Requests should target `master` as the base branch. +- All other Pull Requests (bug fixes, enhancements, etc.) should target `development` as the base branch. +- `release/vX.Y.X` branches will be used for release candidates when moving new features from `development` to `master`. + Beta builds will be created from tagged commits on release candidate branches. + +## Review + +- We welcome code reviews from anyone. A committer is required to formally + accept and merge the changes. +- Reviewers will be looking for things like threading issues, performance + implications, API design, duplication of existing functionality, readability + and code style, avoidance of bloat (scope-creep), etc. +- Reviewers will likely ask questions to better understand your change. +- Reviewers will make comments about changes to your patch: + - MUST means that the change is required + - SHOULD means that the change is suggested, further discussion on the + subject may be required + - COULD means that the change is optional + +## Timeline and Managing Expectations + +As we continue to engage contributors and learn best practices for running a successful open source project, our processes +and guidance will likely evolve. We will try to communicate expectations as we are able and to always be responsive. We +hope that the community will share their suggestions for improving this engagement. Based on the level of initial interest +we receive and the availability of resources to evaluate contributions, we anticipate the following: + +- We will initially prioritize pull requests that include small bug fixes and code that addresses potential vulnerabilities + as well as pull requests that include improvements for processor language specifications because these require a + reasonable amount of effort to evaluate and will help us exercise and revise our process for accepting contributions. In + other words, we are going to start small in order to work out the kinks first. +- We are committed to maintaining the integrity and security of our code base. In addition to the careful review the + maintainers will give to code contributions to make sure they do not introduce new bugs or vulnerabilities, we will be + trying to identify best practices to incorporate with our open source project so that contributors can have more control + over whether their contributions are accepted. These might include things like style guides and requirements for tests and + documentation to accompany some code contributions. As a result, it may take a long time for some contributions to be + accepted. This does not mean we are ignoring them. +- We are committed to integrating this GitHub project with our team's regular development work flow so that the open source + project remains dynamic and relevant. This may affect our responsiveness and ability to accept pull requests + quickly. This does not mean we are ignoring them. +- Not all innovative ideas need to be accepted as pull requests into this GitHub project to be valuable to the community. + There may be times when we recommend that you just share your code for some enhancement to Ghidra from your own + repository. As we identify and recognize extensions that are of general interest to the reverse engineering community, we + may seek to incorporate them with our baseline. + +## Legal + +Consistent with Section D.6. of the GitHub Terms of Service as of 2019, and the MIT license, the project maintainer for this project accepts contributions using the inbound=outbound model. +When you submit a pull request to this repository (inbound), you are agreeing to license your contribution under the same terms as specified in [LICENSE] (outbound). + +This is an open source project. +Contributions you make to this repository are completely voluntary. +When you submit an issue, bug report, question, enhancement, pull request, etc., you are offering your contribution without expectation of payment, you expressly waive any future pay claims against PepperDash related to your contribution, and you acknowledge that this does not create an obligation on the part of PepperDash of any kind. +Furthermore, your contributing to this project does not create an employer-employee relationship between the PepperDash and the contributor. + +[issues]: https://github.com/PepperDash/Essentials/issues +[repository]: https://github.com/PepperDash/Essentials +[LICENSE]: https://github.com/PepperDash/Essentials/blob/master/LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..d67fed77 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,7 @@ +Copyright (c) <2020> PepperDash Technology Corporation + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index 5a542fa0..4e814af9 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -168,6 +168,16 @@ namespace PepperDash.Essentials.Bridges (device as PepperDash.Essentials.Devices.Common.Occupancy.GlsOccupancySensorBaseController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } + else if (device is StatusSignController) + { + (device as StatusSignController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } + else if (device is C2nRthsController) + { + (device as C2nRthsController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } } } diff --git a/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs new file mode 100644 index 00000000..58f4600d --- /dev/null +++ b/PepperDashEssentials/Bridges/C2nRthsControllerBridge.cs @@ -0,0 +1,38 @@ +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class C2nRthsControllerApiExtensions + { + public static void LinkToApi(this C2nRthsController device, BasicTriList triList, uint joinStart, + string joinMapKey) + { + var joinMap = new C2nRthsControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, device, "Linking to Trilist '{0}'", triList.ID.ToString("X")); + + + triList.SetBoolSigAction(joinMap.TemperatureFormat, device.SetTemperatureFormat); + + device.IsOnline.LinkInputSig(triList.BooleanInput[joinMap.IsOnline]); + device.TemperatureFeedback.LinkInputSig(triList.UShortInput[joinMap.Temperature]); + device.HumidityFeedback.LinkInputSig(triList.UShortInput[joinMap.Humidity]); + + triList.StringInput[joinMap.Name].StringValue = device.Name; + + + } + + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index c85854b6..23294997 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -16,7 +16,7 @@ using Newtonsoft.Json; namespace PepperDash.Essentials.Bridges { - public static class DmChassisControllerApiExtentions + public static class DmChassisControllerApiExtensions { public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) { @@ -81,14 +81,14 @@ namespace PepperDash.Essentials.Bridges } } - if (basicTxDevice != null && advancedTxDevice == null) - trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; - - if (advancedTxDevice != null) + if (advancedTxDevice != null) // Advanced TX device { advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + // Flag if the TX is an advanced endpoint type + trilist.BooleanInput[joinMap.TxAdvancedIsPresent + ioSlot].BoolValue = true; } - else if(advancedTxDevice == null || basicTxDevice != null) + else if(advancedTxDevice == null || basicTxDevice != null) // Basic TX device { Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot); dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); diff --git a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs index 2017acb4..91f8c6d7 100644 --- a/PepperDashEssentials/Bridges/DmTxControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmTxControllerBridge.cs @@ -57,7 +57,7 @@ namespace PepperDash.Essentials.Bridges trilist.UShortInput[joinMap.HdcpSupportCapability].UShortValue = (ushort)tx.HdcpSupportCapability; - if(txR.InputPorts[DmPortName.HdmiIn] != null) + if (txR.InputPorts[DmPortName.HdmiIn] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn]; @@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Bridges SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState, trilist); } } - + if (txR.InputPorts[DmPortName.HdmiIn1] != null) { var inputPort = txR.InputPorts[DmPortName.HdmiIn1]; @@ -103,6 +103,22 @@ namespace PepperDash.Essentials.Bridges } } + + var txFreeRun = tx as IHasFreeRun; + if (txFreeRun != null) + { + txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled]); + trilist.SetBoolSigAction(joinMap.FreeRunEnabled, new Action(b => txFreeRun.SetFreeRunEnabled(b))); + } + + var txVga = tx as IVgaBrightnessContrastControls; + { + txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness]); + txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast]); + + trilist.SetUShortSigAction(joinMap.VgaBrightness, new Action(u => txVga.SetVgaBrightness(u))); + trilist.SetUShortSigAction(joinMap.VgaContrast, new Action(u => txVga.SetVgaContrast(u))); + } } static void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) diff --git a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs index fd79a64a..44250f4c 100644 --- a/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs +++ b/PepperDashEssentials/Bridges/GlsOccupancySensorBaseControllerBridge.cs @@ -1,110 +1,114 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Essentials.Devices.Common.Occupancy; - -using PepperDash.Essentials.Core; -using PepperDash.Core; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Bridges -{ - public static class GlsOccupancySensorBaseControllerApiExtensions - { - public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey) - { - GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap(); - - var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - #region Single and Dual Sensor Stuff - occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - - // Occupied status - trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied())); - trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant())); - occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); - occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); - occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); - - // Timouts - trilist.SetUShortSigAction(joinMap.Timeout, new Action((u) => occController.SetRemoteTimeout(u))); - occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); - occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); - - // LED Flash - trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false))); - occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); - - // Short Timeout - trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true))); - trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false))); - occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); - - // PIR Sensor - trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true))); - trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false))); - occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); - - // PIR Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); - occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); - - // PIR Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); - occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); - #endregion - - #region Dual Technology Sensor Stuff - var odtOccController = occController as GlsOdtOccupancySensorController; - - if (odtOccController != null) - { - // OR When Vacated - trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action((b) => odtOccController.SetOrWhenVacatedState(b))); - odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); - - // AND When Vacated - trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action((b) => odtOccController.SetAndWhenVacatedState(b))); - odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); - - // Ultrasonic A Sensor - trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false))); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); - - // Ultrasonic B Sensor - trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true))); - trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false))); - odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); - - // US Sensitivity in Occupied State - trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b))); - odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); - - // US Sensitivity in Vacant State - trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action((b) => odtOccController.IncrementUsSensitivityInVacantState(b))); - trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); - odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); - - } - #endregion - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Essentials.Devices.Common.Occupancy; + +using PepperDash.Essentials.Core; +using PepperDash.Core; + +using Newtonsoft.Json; + +namespace PepperDash.Essentials.Bridges +{ + public static class GlsOccupancySensorBaseControllerApiExtensions + { + public static void LinkToApi(this GlsOccupancySensorBaseController occController, BasicTriList trilist, uint joinStart, string joinMapKey) + { + GlsOccupancySensorBaseJoinMap joinMap = new GlsOccupancySensorBaseJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + #region Single and Dual Sensor Stuff + occController.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + // Occupied status + trilist.SetSigTrueAction(joinMap.ForceOccupied, new Action(() => occController.ForceOccupied())); + trilist.SetSigTrueAction(joinMap.ForceVacant, new Action(() => occController.ForceVacant())); + occController.RoomIsOccupiedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RoomOccupiedFeedback]); + occController.RoomIsOccupiedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.RoomVacantFeedback]); + occController.RawOccupancyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyFeedback]); + + // Timouts + trilist.SetUShortSigAction(joinMap.Timeout, new Action((u) => occController.SetRemoteTimeout(u))); + occController.CurrentTimeoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.Timeout]); + occController.LocalTimoutFeedback.LinkInputSig(trilist.UShortInput[joinMap.TimeoutLocalFeedback]); + + // LED Flash + trilist.SetSigTrueAction(joinMap.EnableLedFlash, new Action(() => occController.SetLedFlashEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableLedFlash, new Action(() => occController.SetLedFlashEnable(false))); + occController.LedFlashEnabledFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.EnableLedFlash]); + + // Short Timeout + trilist.SetSigTrueAction(joinMap.EnableShortTimeout, new Action(() => occController.SetShortTimeoutState(true))); + trilist.SetSigTrueAction(joinMap.DisableShortTimeout, new Action(() => occController.SetShortTimeoutState(false))); + occController.ShortTimeoutEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableShortTimeout]); + + // PIR Sensor + trilist.SetSigTrueAction(joinMap.EnablePir, new Action(() => occController.SetPirEnable(true))); + trilist.SetSigTrueAction(joinMap.DisablePir, new Action(() => occController.SetPirEnable(false))); + occController.PirSensorEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnablePir]); + + // PIR Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementPirInOccupiedState, new Action((b) => occController.IncrementPirSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInOccupiedState, new Action((b) => occController.DecrementPirSensitivityInOccupiedState(b))); + occController.PirSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInOccupiedState]); + + // PIR Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementPirInVacantState, new Action((b) => occController.IncrementPirSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementPirInVacantState, new Action((b) => occController.DecrementPirSensitivityInVacantState(b))); + occController.PirSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.PirSensitivityInVacantState]); + #endregion + + #region Dual Technology Sensor Stuff + var odtOccController = occController as GlsOdtOccupancySensorController; + + if (odtOccController != null) + { + // OR When Vacated + trilist.SetBoolSigAction(joinMap.OrWhenVacated, new Action((b) => odtOccController.SetOrWhenVacatedState(b))); + odtOccController.OrWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OrWhenVacated]); + + // AND When Vacated + trilist.SetBoolSigAction(joinMap.AndWhenVacated, new Action((b) => odtOccController.SetAndWhenVacatedState(b))); + odtOccController.AndWhenVacatedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AndWhenVacated]); + + // Ultrasonic A Sensor + trilist.SetSigTrueAction(joinMap.EnableUsA, new Action(() => odtOccController.SetUsAEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsA, new Action(() => odtOccController.SetUsAEnable(false))); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsA]); + + // Ultrasonic B Sensor + trilist.SetSigTrueAction(joinMap.EnableUsB, new Action(() => odtOccController.SetUsBEnable(true))); + trilist.SetSigTrueAction(joinMap.DisableUsB, new Action(() => odtOccController.SetUsBEnable(false))); + odtOccController.UltrasonicAEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsB]); + + // US Sensitivity in Occupied State + trilist.SetBoolSigAction(joinMap.IncrementUsInOccupiedState, new Action((b) => odtOccController.IncrementUsSensitivityInOccupiedState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInOccupiedState, new Action((b) => odtOccController.DecrementUsSensitivityInOccupiedState(b))); + odtOccController.UltrasonicSensitivityInOccupiedStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInOccupiedState]); + + // US Sensitivity in Vacant State + trilist.SetBoolSigAction(joinMap.IncrementUsInVacantState, new Action((b) => odtOccController.IncrementUsSensitivityInVacantState(b))); + trilist.SetBoolSigAction(joinMap.DecrementUsInVacantState, new Action((b) => odtOccController.DecrementUsSensitivityInVacantState(b))); + odtOccController.UltrasonicSensitivityInVacantStateFeedback.LinkInputSig(trilist.UShortInput[joinMap.UsSensitivityInVacantState]); + + //Sensor Raw States + odtOccController.RawOccupancyPirFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyPirFeedback]); + odtOccController.RawOccupancyUsFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RawOccupancyUsFeedback]); + + } + #endregion + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs new file mode 100644 index 00000000..be0f002e --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/C2nRthsControllerJoinMap.cs @@ -0,0 +1,43 @@ +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class C2nRthsControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint Temperature { get; set; } + public uint Humidity { get; set; } + public uint TemperatureFormat { get; set; } + + public C2nRthsControllerJoinMap() + { + //digital + IsOnline = 1; + TemperatureFormat = 2; + + //Analog + Temperature = 2; + Humidity = 3; + + //serial + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof(uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint)propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index d04004b9..7c920cc4 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -139,6 +139,7 @@ namespace PepperDash.Essentials.Bridges OutputEndpointOnline = OutputEndpointOnline + joinOffset; HdcpSupportState = HdcpSupportState + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset; + TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset; } } } diff --git a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs index e68e5ad2..ff673cab 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/DmTxControllerJoinMap.cs @@ -18,6 +18,10 @@ namespace PepperDash.Essentials.Bridges /// High when video sync is detected /// public uint VideoSyncStatus { get; set; } + /// + /// + /// + public uint FreeRunEnabled { get; set; } #endregion #region Analogs @@ -41,6 +45,16 @@ namespace PepperDash.Essentials.Bridges /// Sets and reports the current HDCP state for the corresponding input port /// public uint Port2HdcpState { get; set; } + + /// + /// Sets and reports the current VGA Brightness level + /// + public uint VgaBrightness { get; set; } + + /// + /// Sets and reports the current VGA Contrast level + /// + public uint VgaContrast { get; set; } #endregion #region Serials @@ -56,6 +70,7 @@ namespace PepperDash.Essentials.Bridges // Digital IsOnline = 1; VideoSyncStatus = 2; + FreeRunEnabled = 3; // Serial CurrentInputResolution = 1; // Analog @@ -64,6 +79,8 @@ namespace PepperDash.Essentials.Bridges HdcpSupportCapability = 3; Port1HdcpState = 4; Port2HdcpState = 5; + VgaBrightness = 6; + VgaContrast = 7; } public override void OffsetJoinNumbers(uint joinStart) @@ -72,12 +89,15 @@ namespace PepperDash.Essentials.Bridges IsOnline = IsOnline + joinOffset; VideoSyncStatus = VideoSyncStatus + joinOffset; + FreeRunEnabled = FreeRunEnabled + joinOffset; CurrentInputResolution = CurrentInputResolution + joinOffset; VideoInput = VideoInput + joinOffset; AudioInput = AudioInput + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset; Port1HdcpState = Port1HdcpState + joinOffset; Port2HdcpState = Port2HdcpState + joinOffset; + VgaBrightness = VgaBrightness + joinOffset; + VgaContrast = VgaContrast + joinOffset; } } } \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs index ee7de892..a48ad0d9 100644 --- a/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs +++ b/PepperDashEssentials/Bridges/JoinMaps/GlsOccupancySensorBaseJoinMap.cs @@ -1,219 +1,230 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Bridges -{ - public class GlsOccupancySensorBaseJoinMap : JoinMapBase - { - #region Digitals - - /// - /// High when device is online - /// - public uint IsOnline { get; set; } - /// - /// Forces the device to report occupied status - /// - public uint ForceOccupied { get; set; } - /// - /// Forces the device to report vacant status - /// - public uint ForceVacant { get; set; } - /// - /// Enables raw status reporting - /// - public uint EnableRawStates { get; set; } - /// - /// High when raw occupancy is detected - /// - public uint RawOccupancyFeedback { get; set; } - /// - /// High when occupancy is detected - /// - public uint RoomOccupiedFeedback { get; set; } - /// - /// Hich when occupancy is detected in the grace period - /// - public uint GraceOccupancyDetectedFeedback { get; set; } - /// - /// High when vacancy is detected - /// - public uint RoomVacantFeedback { get; set; } - - /// - /// Enables the LED Flash when set high - /// - public uint EnableLedFlash { get; set; } - /// - /// Disables the LED flash when set high - /// - public uint DisableLedFlash { get; set; } - /// - /// Enables the Short Timeout - /// - public uint EnableShortTimeout { get; set; } - /// - /// Disables the Short Timout - /// - public uint DisableShortTimeout { get; set; } - /// - /// Set high to enable one technology to trigger occupancy - /// - public uint OrWhenVacated { get; set; } - /// - /// Set high to require both technologies to trigger occupancy - /// - public uint AndWhenVacated { get; set; } - /// - /// Enables Ultrasonic Sensor A - /// - public uint EnableUsA { get; set; } - /// - /// Disables Ultrasonic Sensor A - /// - public uint DisableUsA { get; set; } - /// - /// Enables Ultrasonic Sensor B - /// - public uint EnableUsB { get; set; } - /// - /// Disables Ultrasonic Sensor B - /// - public uint DisableUsB { get; set; } - /// - /// Enables Pir - /// - public uint EnablePir { get; set; } - /// - /// Disables Pir - /// - public uint DisablePir { get; set; } - public uint IncrementUsInOccupiedState { get; set; } - public uint DecrementUsInOccupiedState { get; set; } - public uint IncrementUsInVacantState { get; set; } - public uint DecrementUsInVacantState { get; set; } - public uint IncrementPirInOccupiedState { get; set; } - public uint DecrementPirInOccupiedState { get; set; } - public uint IncrementPirInVacantState { get; set; } - public uint DecrementPirInVacantState { get; set; } - #endregion - - #region Analogs - /// - /// Sets adn reports the remote timeout value - /// - public uint Timeout { get; set; } - /// - /// Reports the local timeout value - /// - public uint TimeoutLocalFeedback { get; set; } - /// - /// Sets the minimum internal photo sensor value and reports the current level - /// - public uint InternalPhotoSensorValue { get; set; } - /// - /// Sets the minimum external photo sensor value and reports the current level - /// - public uint ExternalPhotoSensorValue { get; set; } - - public uint UsSensitivityInOccupiedState { get; set; } - - public uint UsSensitivityInVacantState { get; set; } - - public uint PirSensitivityInOccupiedState { get; set; } - - public uint PirSensitivityInVacantState { get; set; } - #endregion - - public GlsOccupancySensorBaseJoinMap() - { - IsOnline = 1; - ForceOccupied = 2; - ForceVacant = 3; - EnableRawStates = 4; - RoomOccupiedFeedback = 2; - GraceOccupancyDetectedFeedback = 3; - RoomVacantFeedback = 4; - RawOccupancyFeedback = 5; - EnableLedFlash = 11; - DisableLedFlash = 12; - EnableShortTimeout = 13; - DisableShortTimeout = 14; - OrWhenVacated = 15; - AndWhenVacated = 16; - EnableUsA = 17; - DisableUsA = 18; - EnableUsB = 19; - DisableUsB = 20; - EnablePir = 21; - DisablePir = 22; - DisablePir = 23; - IncrementUsInOccupiedState = 24; - DecrementUsInOccupiedState = 25; - IncrementUsInVacantState = 26; - DecrementUsInVacantState = 27; - IncrementPirInOccupiedState = 28; - DecrementPirInOccupiedState = 29; - IncrementPirInVacantState = 30; - DecrementPirInVacantState = 31; - - Timeout = 1; - TimeoutLocalFeedback = 2; - InternalPhotoSensorValue = 3; - ExternalPhotoSensorValue = 4; - UsSensitivityInOccupiedState = 5; - UsSensitivityInVacantState = 6; - PirSensitivityInOccupiedState = 7; - PirSensitivityInVacantState = 8; - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - ForceOccupied = ForceOccupied + joinOffset; - ForceVacant = ForceVacant + joinOffset; - EnableRawStates = EnableRawStates + joinOffset; - RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; - GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; - RoomVacantFeedback = RoomVacantFeedback + joinOffset; - RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; - EnableLedFlash = EnableLedFlash + joinOffset; - DisableLedFlash = DisableLedFlash + joinOffset; - EnableShortTimeout = EnableShortTimeout + joinOffset; - DisableShortTimeout = DisableShortTimeout + joinOffset; - OrWhenVacated = OrWhenVacated + joinOffset; - AndWhenVacated = AndWhenVacated + joinOffset; - EnableUsA = EnableUsA + joinOffset; - DisableUsA = DisableUsA + joinOffset; - EnableUsB = EnableUsB + joinOffset; - DisableUsB = DisableUsB + joinOffset; - EnablePir = EnablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - DisablePir = DisablePir + joinOffset; - IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; - DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; - IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; - DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; - IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; - DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; - IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; - DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; - - Timeout = Timeout + joinOffset; - TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; - InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; - ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; - UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; - UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; - PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; - PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; - } - } - -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class GlsOccupancySensorBaseJoinMap : JoinMapBase + { + #region Digitals + + /// + /// High when device is online + /// + public uint IsOnline { get; set; } + /// + /// Forces the device to report occupied status + /// + public uint ForceOccupied { get; set; } + /// + /// Forces the device to report vacant status + /// + public uint ForceVacant { get; set; } + /// + /// Enables raw status reporting + /// + public uint EnableRawStates { get; set; } + /// + /// High when raw occupancy is detected + /// + public uint RawOccupancyFeedback { get; set; } + /// + /// High when PIR sensor detects motion + /// + public uint RawOccupancyPirFeedback { get; set; } + /// + /// High when US sensor detects motion + /// + public uint RawOccupancyUsFeedback { get; set; } + /// + /// High when occupancy is detected + /// + public uint RoomOccupiedFeedback { get; set; } + /// + /// Hich when occupancy is detected in the grace period + /// + public uint GraceOccupancyDetectedFeedback { get; set; } + /// + /// High when vacancy is detected + /// + public uint RoomVacantFeedback { get; set; } + + /// + /// Enables the LED Flash when set high + /// + public uint EnableLedFlash { get; set; } + /// + /// Disables the LED flash when set high + /// + public uint DisableLedFlash { get; set; } + /// + /// Enables the Short Timeout + /// + public uint EnableShortTimeout { get; set; } + /// + /// Disables the Short Timout + /// + public uint DisableShortTimeout { get; set; } + /// + /// Set high to enable one technology to trigger occupancy + /// + public uint OrWhenVacated { get; set; } + /// + /// Set high to require both technologies to trigger occupancy + /// + public uint AndWhenVacated { get; set; } + /// + /// Enables Ultrasonic Sensor A + /// + public uint EnableUsA { get; set; } + /// + /// Disables Ultrasonic Sensor A + /// + public uint DisableUsA { get; set; } + /// + /// Enables Ultrasonic Sensor B + /// + public uint EnableUsB { get; set; } + /// + /// Disables Ultrasonic Sensor B + /// + public uint DisableUsB { get; set; } + /// + /// Enables Pir + /// + public uint EnablePir { get; set; } + /// + /// Disables Pir + /// + public uint DisablePir { get; set; } + public uint IncrementUsInOccupiedState { get; set; } + public uint DecrementUsInOccupiedState { get; set; } + public uint IncrementUsInVacantState { get; set; } + public uint DecrementUsInVacantState { get; set; } + public uint IncrementPirInOccupiedState { get; set; } + public uint DecrementPirInOccupiedState { get; set; } + public uint IncrementPirInVacantState { get; set; } + public uint DecrementPirInVacantState { get; set; } + #endregion + + #region Analogs + /// + /// Sets adn reports the remote timeout value + /// + public uint Timeout { get; set; } + /// + /// Reports the local timeout value + /// + public uint TimeoutLocalFeedback { get; set; } + /// + /// Sets the minimum internal photo sensor value and reports the current level + /// + public uint InternalPhotoSensorValue { get; set; } + /// + /// Sets the minimum external photo sensor value and reports the current level + /// + public uint ExternalPhotoSensorValue { get; set; } + + public uint UsSensitivityInOccupiedState { get; set; } + + public uint UsSensitivityInVacantState { get; set; } + + public uint PirSensitivityInOccupiedState { get; set; } + + public uint PirSensitivityInVacantState { get; set; } + #endregion + + public GlsOccupancySensorBaseJoinMap() + { + IsOnline = 1; + ForceOccupied = 2; + ForceVacant = 3; + EnableRawStates = 4; + RoomOccupiedFeedback = 2; + GraceOccupancyDetectedFeedback = 3; + RoomVacantFeedback = 4; + RawOccupancyFeedback = 5; + RawOccupancyPirFeedback = 6; + RawOccupancyUsFeedback = 7; + EnableLedFlash = 11; + DisableLedFlash = 12; + EnableShortTimeout = 13; + DisableShortTimeout = 14; + OrWhenVacated = 15; + AndWhenVacated = 16; + EnableUsA = 17; + DisableUsA = 18; + EnableUsB = 19; + DisableUsB = 20; + EnablePir = 21; + DisablePir = 22; + IncrementUsInOccupiedState = 23; + DecrementUsInOccupiedState = 24; + IncrementUsInVacantState = 25; + DecrementUsInVacantState = 26; + IncrementPirInOccupiedState = 27; + DecrementPirInOccupiedState = 28; + IncrementPirInVacantState = 29; + DecrementPirInVacantState = 30; + + Timeout = 1; + TimeoutLocalFeedback = 2; + InternalPhotoSensorValue = 3; + ExternalPhotoSensorValue = 4; + UsSensitivityInOccupiedState = 5; + UsSensitivityInVacantState = 6; + PirSensitivityInOccupiedState = 7; + PirSensitivityInVacantState = 8; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + ForceOccupied = ForceOccupied + joinOffset; + ForceVacant = ForceVacant + joinOffset; + EnableRawStates = EnableRawStates + joinOffset; + RoomOccupiedFeedback = RoomOccupiedFeedback + joinOffset; + GraceOccupancyDetectedFeedback = GraceOccupancyDetectedFeedback + joinOffset; + RoomVacantFeedback = RoomVacantFeedback + joinOffset; + RawOccupancyFeedback = RawOccupancyFeedback + joinOffset; + RawOccupancyPirFeedback = RawOccupancyPirFeedback + joinOffset; + RawOccupancyUsFeedback = RawOccupancyUsFeedback + joinOffset; + EnableLedFlash = EnableLedFlash + joinOffset; + DisableLedFlash = DisableLedFlash + joinOffset; + EnableShortTimeout = EnableShortTimeout + joinOffset; + DisableShortTimeout = DisableShortTimeout + joinOffset; + OrWhenVacated = OrWhenVacated + joinOffset; + AndWhenVacated = AndWhenVacated + joinOffset; + EnableUsA = EnableUsA + joinOffset; + DisableUsA = DisableUsA + joinOffset; + EnableUsB = EnableUsB + joinOffset; + DisableUsB = DisableUsB + joinOffset; + EnablePir = EnablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + DisablePir = DisablePir + joinOffset; + IncrementUsInOccupiedState = IncrementUsInOccupiedState + joinOffset; + DecrementUsInOccupiedState = DecrementUsInOccupiedState + joinOffset; + IncrementUsInVacantState = IncrementUsInVacantState + joinOffset; + DecrementUsInVacantState = DecrementUsInVacantState + joinOffset; + IncrementPirInOccupiedState = IncrementPirInOccupiedState + joinOffset; + DecrementPirInOccupiedState = DecrementPirInOccupiedState + joinOffset; + IncrementPirInVacantState = IncrementPirInVacantState + joinOffset; + DecrementPirInVacantState = DecrementPirInVacantState + joinOffset; + + Timeout = Timeout + joinOffset; + TimeoutLocalFeedback = TimeoutLocalFeedback + joinOffset; + InternalPhotoSensorValue = InternalPhotoSensorValue + joinOffset; + ExternalPhotoSensorValue = ExternalPhotoSensorValue + joinOffset; + UsSensitivityInOccupiedState = UsSensitivityInOccupiedState + joinOffset; + UsSensitivityInVacantState = UsSensitivityInVacantState + joinOffset; + PirSensitivityInOccupiedState = PirSensitivityInOccupiedState + joinOffset; + PirSensitivityInVacantState = PirSensitivityInVacantState + joinOffset; + } + } + +} diff --git a/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs new file mode 100644 index 00000000..d3a95383 --- /dev/null +++ b/PepperDashEssentials/Bridges/JoinMaps/StatusSignControllerJoinMap.cs @@ -0,0 +1,49 @@ +using System.Linq; +using Crestron.SimplSharp.Reflection; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Bridges +{ + public class StatusSignControllerJoinMap:JoinMapBase + { + public uint IsOnline { get; set; } + public uint Name { get; set; } + public uint RedLed { get; set; } + public uint GreenLed { get; set; } + public uint BlueLed { get; set; } + public uint RedControl { get; set; } + public uint GreenControl { get; set; } + public uint BlueControl { get; set; } + + public StatusSignControllerJoinMap() + { + //digital + IsOnline = 1; + RedControl = 2; + GreenControl = 3; + BlueControl = 4; + + //Analog + RedLed = 2; + GreenLed = 3; + BlueLed = 4; + + //string + Name = 1; + + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + var properties = + GetType().GetCType().GetProperties().Where(p => p.PropertyType == typeof (uint)).ToList(); + + foreach (var propertyInfo in properties) + { + propertyInfo.SetValue(this, (uint) propertyInfo.GetValue(this, null) + joinOffset, null); + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs new file mode 100644 index 00000000..df38ba26 --- /dev/null +++ b/PepperDashEssentials/Bridges/StatusSignControllerBridge.cs @@ -0,0 +1,65 @@ +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.CrestronIO; + +namespace PepperDash.Essentials.Bridges +{ + public static class StatusSignDeviceApiExtensions + { + public static void LinkToApi(this StatusSignController ssDevice, BasicTriList trilist, uint joinStart, + string joinMapKey) + { + var joinMap = new StatusSignControllerJoinMap(); + + var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, ssDevice, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + trilist.SetBoolSigAction(joinMap.RedControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.GreenControl, b => EnableControl(trilist, joinMap, ssDevice)); + trilist.SetBoolSigAction(joinMap.BlueControl, b => EnableControl(trilist, joinMap, ssDevice)); + + trilist.SetUShortSigAction(joinMap.RedLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.GreenLed, u => SetColor(trilist, joinMap, ssDevice)); + trilist.SetUShortSigAction(joinMap.BlueLed, u => SetColor(trilist, joinMap, ssDevice)); + + trilist.StringInput[joinMap.Name].StringValue = ssDevice.Name; + + ssDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + ssDevice.RedLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.RedControl]); + ssDevice.BlueLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.BlueControl]); + ssDevice.GreenLedEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.GreenControl]); + + ssDevice.RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed]); + ssDevice.BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed]); + ssDevice.GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed]); + + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redEnable = triList.BooleanOutput[joinMap.RedControl].BoolValue; + var greenEnable = triList.BooleanOutput[joinMap.GreenControl].BoolValue; + var blueEnable = triList.BooleanOutput[joinMap.BlueControl].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) + { + var redBrightness = triList.UShortOutput[joinMap.RedLed].UShortValue; + var greenBrightness = triList.UShortOutput[joinMap.GreenLed].UShortValue; + var blueBrightness = triList.UShortOutput[joinMap.BlueLed].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/SystemMonitorBridge.cs b/PepperDashEssentials/Bridges/SystemMonitorBridge.cs index d374b9df..4e66ea08 100644 --- a/PepperDashEssentials/Bridges/SystemMonitorBridge.cs +++ b/PepperDashEssentials/Bridges/SystemMonitorBridge.cs @@ -61,6 +61,16 @@ namespace PepperDash.Essentials.Bridges (b => SystemMonitor.ProgramCollection[programNumber].RegistrationState = eProgramRegistrationState.Unregister)); p.Value.ProgramUnregisteredFeedback.LinkInputSig(trilist.BooleanInput[programSlotJoinStart + joinMap.ProgramUnregister]); + p.Value.ProgramNameFeedback.LinkInputSig(trilist.StringInput[programSlotJoinStart + joinMap.ProgramName]); + p.Value.ProgramCompileTimeFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCompiledTime]); + p.Value.CrestronDataBaseVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramCrestronDatabaseVersion]); + p.Value.EnvironmentVersionFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.ProgramEnvironmentVersion]); + p.Value.AggregatedProgramInfoFeedback.LinkInputSig( + trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo]); + programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin; } } diff --git a/PepperDashEssentials/Configuration Original/Builders/TPConfig.cs b/PepperDashEssentials/Configuration Original/Builders/TPConfig.cs deleted file mode 100644 index 94edaf14..00000000 --- a/PepperDashEssentials/Configuration Original/Builders/TPConfig.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials -{ - - //public class TPConfig : DeviceConfig - //{ - // new public TPConfigProperties Properties { get; set; } - //} - - //public class TPConfigProperties - //{ - // /* - // "properties": { - // "ipId": "aa", - // "defaultSystemKey": "system1", - // "sgdPath": "\\NVRAM\\Program1\\Sgds\\PepperDash Essentials TSW1050_v0.9.sgd", - // "usesSplashPage": true, - // "showDate": true, - // "showTime": false - // } - // */ - // public uint IpId { get; set; } - // public string deafultSystemKey { get; set; } - // public string SgdPath { get; set; } - // public bool UsesSplashPage { get; set; } - // public bool ShowDate { get; set; } - // public bool ShowTime { get; set; } - - //} - - - - - ///// - ///// The gist of this converter: The comspec JSON comes in with normal values that need to be converted - ///// into enum names. This converter takes the value and applies the appropriate enum's name prefix to the value - ///// and then returns the enum value using Enum.Parse - ///// - //public class TPPropertiesConverter : JsonConverter - //{ - // public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - // { - // return JObject.Load(reader); - // } - - // /// - // /// This will be hit with every value in the ComPortConfig class. We only need to - // /// do custom conversion on the comspec items. - // /// - // public override bool CanConvert(Type objectType) - // { - // return true; - // } - - // public override bool CanRead { get { return true; } } - // public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - // { - // throw new NotImplementedException(); - // } - //} -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/ConfigTieLine.cs b/PepperDashEssentials/Configuration Original/ConfigTieLine.cs deleted file mode 100644 index fabdd409..00000000 --- a/PepperDashEssentials/Configuration Original/ConfigTieLine.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Linq; -using Newtonsoft.Json; - -using PepperDash.Essentials.Core; -using PepperDash.Core; - -namespace PepperDash.Essentials -{ - public class ConfigTieLine - { - [JsonProperty(Required=Required.Always)] - public string SourceDeviceKey { get; set; } - - [JsonProperty(Required = Required.Always)] - public string SourcePortKey { get; set; } - - [JsonProperty(Required = Required.Always)] - public string DestinationDeviceKey { get; set; } - - [JsonProperty(Required = Required.Always)] - public string DestinationPortKey { get; set; } - - public override string ToString() - { - return string.Format("Tie line: [{0}]{1} --> [{2}]{3}", SourceDeviceKey, SourcePortKey, DestinationDeviceKey, DestinationPortKey); - } - - /// - /// Returns a tie line if one can be constructed between the two devices and ports - /// - /// TieLine or null if devices or ports don't exist - public TieLine GetTieLine() - { - var sourceDevice = (IRoutingOutputs)DeviceManager.GetDeviceForKey(SourceDeviceKey); - var destinationDevice = (IRoutingInputs)DeviceManager.GetDeviceForKey(DestinationDeviceKey); - - if (sourceDevice == null) - { - Debug.Console(0, " Cannot create TieLine. Source device '{0}' not found or does not have outputs", - SourceDeviceKey); - return null; - } - else if (destinationDevice == null) - { - Debug.Console(0, " Cannot create TieLine. Destination device '{0}' not found or does not have inputs", - DestinationDeviceKey); - return null; - } - else - { - // Get the ports by key name from the lists - RoutingOutputPort sourcePort = sourceDevice.OutputPorts.FirstOrDefault( - p => p.Key.Equals(SourcePortKey, System.StringComparison.OrdinalIgnoreCase)); - //RoutingOutputPort sourcePort = null; - //sourceDevice.OutputPorts.TryGetValue(SourcePortKey, out sourcePort); - if (sourcePort == null) - { - Debug.Console(0, " Cannot create TieLine {0}-->{1}. Source device does not have output port '{2}'", - sourceDevice.Key, destinationDevice.Key, SourcePortKey); - return null; - } - - RoutingInputPort destinationPort = destinationDevice.InputPorts.FirstOrDefault( - p => p.Key.Equals(DestinationPortKey, System.StringComparison.OrdinalIgnoreCase)); - //RoutingInputPort destinationPort = null; - //destinationDevice.InputPorts.TryGetValue(DestinationPortKey, out destinationPort); - if (destinationPort == null) - { - Debug.Console(0, " Cannot create TieLine {0}-->{1}. Destination device does not have input port '{2}'", - sourceDevice.Key, destinationDevice.Key, DestinationPortKey); - return null; - } - - var tl = new TieLine(sourcePort, destinationPort); - Debug.Console(1, " Created {0}", this); - return tl; - } - } - - } - -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Configuration.cs b/PepperDashEssentials/Configuration Original/Configuration.cs deleted file mode 100644 index 30350e79..00000000 --- a/PepperDashEssentials/Configuration Original/Configuration.cs +++ /dev/null @@ -1,287 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Crestron.SimplSharp; -using Crestron.SimplSharp.CrestronIO; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.CrestronThread; -using Crestron.SimplSharpPro.Diagnostics; -using Crestron.SimplSharpPro.EthernetCommunication; -using Crestron.SimplSharpPro.UI; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices; -//using PepperDash.Essentials.Core.Devices.Dm; -//using PepperDash.Essentials.Fusion; -using PepperDash.Core; - -namespace PepperDash.Essentials -{ - public static class Configuration - { - - public static string LastPath { get; private set; } - public static CrestronControlSystem ControlSystem { get; private set; } - - public static void Initialize(CrestronControlSystem cs) - { - CrestronConsole.AddNewConsoleCommand(ReloadFromConsole, "configreload", "Reloads configuration file", - ConsoleAccessLevelEnum.AccessOperator); - ControlSystem = cs; - } - - public static bool ReadConfiguration(string filePath) - { - try - { - // Read file - if (File.Exists(filePath)) - { - LastPath = filePath; - string json = File.ReadToEnd(filePath, System.Text.Encoding.ASCII); - JObject jo = JObject.Parse(json); - - var info = JsonConvert.DeserializeObject(jo["info"].ToString()); - Debug.Console(0, "\r[Config] file read:"); - Debug.Console(0, " File: {0}", filePath); - Debug.Console(0, " Name: {0}", info.Name); - Debug.Console(0, " Type: {0}", info.SystemTemplateType); - Debug.Console(0, " Date: {0}", info.EditDate); - Debug.Console(0, " ConfigVersion: {0}", info.Version); - Debug.Console(0, " EditedBy: {0}", info.EditedBy); - Debug.Console(0, " Comment: {0}\r", info.Comment); - - // Get the main config object - var jConfig = jo["configuration"]; - - // Devices - var jDevices = (JArray)jConfig["devices"]; - CreateDevices(jDevices); - - // TieLines - var jRouting = jConfig["routing"]; - CreateRouting(jRouting); - - /// Parse the available source list(s) - var jSourceLists = (JArray)jConfig["sourceLists"]; - var jSourceListJson = jSourceLists.ToString(); - List sourceLists = JsonConvert.DeserializeObject>(jSourceListJson); - - // System - var jSystems = (JArray)jConfig["systems"]; - CreateSystems(jSystems, sourceLists); - - // Activate everything - DeviceManager.ActivateAll(); - } - else - { - Debug.Console(0, "[Config] file not found '{0}'", filePath); - return false; - } - } - catch (Exception e) - { - Debug.Console(0, "Configuration read error: \r {0}", e); - return false; - } - - return true; - } - - static void CreateDevices(JArray jDevices) - { - //Debug.Console(0, " Creating {0} devices", jDevices.Count); - //for (int i = 0; i < jDevices.Count; i++) - //{ - // var jDev = jDevices[i]; - - // //var devConfig = JsonConvert.DeserializeObject(jDev.ToString()); - // //Debug.Console(0, "++++++++++++{0}", devConfig); - - - // var group = jDev["group"].Value(); - // Debug.Console(0, " [{0}], creating {1}:{2}", jDev["key"].Value(), - // group, jDev["type"].Value()); - - // Device dev = null; - // if (group.Equals("Display", StringComparison.OrdinalIgnoreCase)) - // dev = DisplayFactory.CreateDisplay(jDev); - // else if (group.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase)) - // dev = DeviceManagerFactory.Create(jDev); - // //else if (group.Equals("Pc", StringComparison.OrdinalIgnoreCase)) - // // dev = PcFactory.Create(jDev); - // //else if (group.Equals("SetTopBox", StringComparison.OrdinalIgnoreCase)) - // // dev = SetTopBoxFactory.Create(jDev); - // //else if (group.Equals("DiscPlayer", StringComparison.OrdinalIgnoreCase)) - // // dev = DiscPlayerFactory.Create(jDev); - // //else if (group.Equals("Touchpanel", StringComparison.OrdinalIgnoreCase)) - // // dev = TouchpanelFactory.Create(jDev); - // else if (group.Equals("dmEndpoint", StringComparison.OrdinalIgnoreCase)) // Add Transmitter and Receiver - // dev = DmFactory.Create(jDev); - // else if (group.Equals("dmChassic", StringComparison.OrdinalIgnoreCase)) - // dev = DmFactory.CreateChassis(jDev); - // else if (group.Equals("processor", StringComparison.OrdinalIgnoreCase)) - // continue; // ignore it. Has no value right now. - // //else if (group.Equals("remote", StringComparison.OrdinalIgnoreCase)) - // // dev = RemoteFactory.Create(jDev); - // else - // { - // Debug.Console(0, " ERROR: Device [{0}] has unknown Group '{1}'. Skipping", - // jDev["key"].Value(), group); - // continue; - // } - - // if (dev != null) - // DeviceManager.AddDevice(dev); - // else - // Debug.Console(0, " ERROR: failed to create device {0}", - // jDev["key"].Value()); - //} - } - - static void CreateSystems(JArray jSystems, List sourceLists) - { -// // assuming one system -// var jSystem = jSystems[0]; -// var name = jSystem.Value("name"); -// var key = FactoryHelper.KeyOrConvertName(jSystem.Value("key"), name); - -// if (jSystem.Value("type").Equals("EssentialsHuddleSpace", StringComparison.OrdinalIgnoreCase)) -// { -// var sys = new HuddleSpaceRoom(key, name); -// var props = jSystem["properties"]; -// var displayKey = props["displayKey"].Value(); -// if (displayKey != null) -// sys.DefaultDisplay = (DisplayBase)DeviceManager.GetDeviceForKey(displayKey); - -// // Add sources from passed in config list -// var myList = sourceLists.FirstOrDefault( -// l => l.Key.Equals(props.Value("sourceListKey"), StringComparison.OrdinalIgnoreCase)); -// if (myList != null) -// AddSourcesToSystem(sys, myList); - -// DeviceManager.AddDevice(sys); - -// //spin up a fusion thing too -//#warning add this fusion connector back in later -// //DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController(sys, 0xf1)); - //} - } - - //static void AddSourcesToSystem(Room system, ConfigSourceList configList) - //{ - //foreach (var configItem in configList.PresentationSources) - //{ - // var src = (IPresentationSource)DeviceManager.GetDeviceForKey(configItem.SourceKey); - // if (src != null) - // system.Sources.Add(configItem.Number, src); - // else - // Debug.Console(0, system, "cannot find source '{0}' from list {1}", - // configItem.SourceKey, configList.Name); - //} - //} - - /// - /// Links up routing, creates tie lines - /// - /// The "Routing" JArray from configuration - static void CreateRouting(JToken jRouting) - { - var jsonTieLines = jRouting["tieLines"].ToString(); - var tieLineConfigs = JsonConvert.DeserializeObject>(jsonTieLines); - foreach (var c in tieLineConfigs) - { - var tl = c.GetTieLine(); - if (tl != null) - TieLineCollection.Default.Add(tl); - } - } - - - /// - /// Returns the IIROutputPorts device (control system, etc) that contains a given IR port - /// - /// - static IROutputPort GetIrPort(JToken propsToken) - { - var portDevName = propsToken.Value("IrPortDevice"); - var portNum = propsToken.Value("IrPortNumber"); - if (portDevName.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)) - { - IIROutputPorts irDev = ControlSystem; - if (portNum <= irDev.NumberOfIROutputPorts) - return ControlSystem.IROutputPorts[portNum]; - else - Debug.Console(0, "[Config] ERROR: IR Port {0} out of range. Range 0-{1} on {2}", portNum, - ControlSystem.IROutputPorts.Count, irDev.ToString()); - } - return null; - } - - static void HandleUnknownType(JToken devToken, string type) - { - Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type, - devToken.Value("Group")); - } - - static void HandleDeviceCreationError(JToken devToken, Exception e) - { - Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}", - devToken["Key"].Value(), e); - } - - /// - /// Console helper to reload - /// - static void ReloadFromConsole(string s) - { - // Gotta tear down everything first! - - if (!string.IsNullOrEmpty(LastPath)) - { - ReadConfiguration(LastPath); - } - } - } - - public class ConfigSourceList - { - [JsonProperty(Required = Required.Always)] - public string Key { get; set; } - - [JsonProperty(Required = Required.Always)] - public string Name { get; set; } - - [JsonProperty(Required = Required.Always)] - public List PresentationSources { get; set; } - - } - - public class ConfigSourceItem - { - [JsonProperty(Required = Required.Always)] - public uint Number { get; set; } - - [JsonProperty(Required = Required.Always)] - public string SourceKey { get; set; } - - public string AlternateName { get; set; } - } - - public class ConfigInfo - { - public string SystemTemplateType { get; set; } - public string ProcessorType { get; set; } - public string Name { get; set; } - public uint ProgramSlotNumber { get; set; } - public string Version { get; set; } - public string EditedBy { get; set; } - public string EditDate { get; set; } - public string Comment { get; set; } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/ConfigurationHelpers.cs b/PepperDashEssentials/Configuration Original/ConfigurationHelpers.cs deleted file mode 100644 index c5dd4c65..00000000 --- a/PepperDashEssentials/Configuration Original/ConfigurationHelpers.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Newtonsoft.Json; - -namespace PepperDash.Essentials -{ - public class SourceListConfigProperties - { - [JsonProperty(Required= Required.Always)] - public uint Number { get; set; } - [JsonProperty(Required= Required.Always)] - public string SourceKey { get; set; } - public string AltName { get; set; } - public string AltIcon { get; set; } - - public SourceListConfigProperties() - { - AltName = ""; - AltIcon = ""; - } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/CommFactory.cs b/PepperDashEssentials/Configuration Original/Factories/CommFactory.cs deleted file mode 100644 index a1b23a4e..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/CommFactory.cs +++ /dev/null @@ -1,54 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; - -//using Newtonsoft.Json; -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class CommFactory -// { -// public static IBasicCommunication CreateCommForDevice(JToken devToken) -// { -// var devKey = devToken.Value("key"); -// IBasicCommunication comm = null; -// try -// { -// var control = devToken["properties"]["control"]; -// var commMethod = control["method"].Value(); -// if (commMethod == "com") -// { -// var comConfig = JsonConvert.DeserializeObject( -// control["comParams"].ToString(), -// new JsonSerializerSettings -// { -// // Needs ObjectCreationHandling to make the ComSpec struct populate -// ObjectCreationHandling = ObjectCreationHandling.Replace, -// Converters = new JsonConverter[] { new ComSpecJsonConverter() } -// }); -// comm = new ComPortController(devKey + "-com", comConfig.GetComPort(), comConfig.ComSpec); -// } -// else if (commMethod == "tcpIp") -// { -// var tcpConfig = JsonConvert.DeserializeObject(control["tcpParams"].ToString()); -// comm = new GenericTcpIpClient(devKey + "-tcp", tcpConfig.Address, tcpConfig.Port, tcpConfig.BufferSize); -// } -// } -// catch (Exception e) -// { -// Debug.Console(0, "Cannot create communication from JSON:\r{0}\r\rException:\r{1}", devToken.ToString(), e); -// } - -// // put it in the device manager if it's the right flavor -// var comDev = comm as Device; -// if (comDev != null) -// DeviceManager.AddDevice(comDev); - -// return comm; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/DeviceMonitorFactory.cs b/PepperDashEssentials/Configuration Original/Factories/DeviceMonitorFactory.cs deleted file mode 100644 index fca42458..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/DeviceMonitorFactory.cs +++ /dev/null @@ -1,38 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; - -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Devices; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class DeviceManagerFactory -// { -// public static Device Create(JToken devToken) -// { -// Device dev = null; -// try -// { -// var devType = devToken.Value("type"); -// var devKey = devToken.Value("key"); -// var devName = devToken.Value("name"); -// if (devType.Equals("DeviceMonitor", StringComparison.OrdinalIgnoreCase)) -// { -// var comm = CommFactory.CreateCommForDevice(devToken); -// if (comm == null) return null; -// dev = new GenericCommunicationMonitoredDevice(devKey, devName, comm, devToken["properties"]["pollString"].Value()); -// } -// else -// FactoryHelper.HandleUnknownType(devToken, devType); -// } -// catch (Exception e) -// { -// FactoryHelper.HandleDeviceCreationError(devToken, e); -// } -// return dev; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/DisplayFactory.cs b/PepperDashEssentials/Configuration Original/Factories/DisplayFactory.cs deleted file mode 100644 index 4b226662..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/DisplayFactory.cs +++ /dev/null @@ -1,122 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; - -//using Newtonsoft.Json; -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -//using PepperDash.Essentials.Displays; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class DisplayFactory -// { -// public static DisplayBase CreateDisplay(JToken devToken) -// { -// DisplayBase dev = null; -// try -// { -// var devType = devToken.Value("type"); -// var devKey = devToken.Value("key"); -// var devName = devToken.Value("name"); -// var properties = devToken["properties"]; - -// if (devType.Equals("MockDisplay", StringComparison.OrdinalIgnoreCase)) -// dev = new MockDisplay(devKey, devName); - -// else if (devType.Equals("NecMPSX", StringComparison.OrdinalIgnoreCase)) -// { -// var comm = CommFactory.CreateCommForDevice(devToken); -// if (comm == null) return null; -// dev = new NecPSXMDisplayCom(devKey, devName, comm); - - - -// //var commMethod = properties["control"]["method"].Value(); - -// //// Helper-ize this? -// //if(commMethod == "com") -// //{ -// // // Move some of this up above??? -// // var comConfig = JsonConvert.DeserializeObject( -// // properties["control"]["comParams"].ToString(), -// // new JsonSerializerSettings { -// // // Needs ObjectCreationHandling to make the ComSpec struct populate -// // ObjectCreationHandling = ObjectCreationHandling.Replace, -// // Converters = new JsonConverter[] { new ComSpecJsonConverter() } -// // }); -// // dev = new NecPSXMDisplayCom(devKey, devName, comConfig.GetComPort(), comConfig.ComSpec); -// //} -// //else if (commMethod == "tcpIp") -// //{ -// // var spec = properties["control"]["tcpSpec"]; -// // var host = spec["address"].Value(); -// // var port = spec["port"].Value(); -// // dev = new NecPSXMDisplayCom(devKey, devName, host, port); -// //} - - - -// } - -// else if (devType.Equals("NecNpPa550", StringComparison.OrdinalIgnoreCase)) -// { -// var proj = new NecPaSeriesProjector(devKey, devName); -// var comm = CreateCommunicationFromPropertiesToken( -// devKey + "-comm", properties, 3000); -// proj.CommunicationMethod = comm; -// dev = proj; -// } -// else -// FactoryHelper.HandleUnknownType(devToken, devType); -// } -// catch (Exception e) -// { -// FactoryHelper.HandleDeviceCreationError(devToken, e); -// } -// return dev; -// } - -// public static IBasicCommunication CreateCommunicationFromPropertiesToken( -// string commKey, JToken properties, int bufferSize) -// { -// Debug.Console(2, "Building port from: {0}", properties.ToString()); - -// var tcpToken = properties["TcpIp"]; -// if (tcpToken != null) -// { -// // Convert the Tcp property -// var spec = JsonConvert.DeserializeObject(tcpToken.ToString()); - -// var tcp = new GenericTcpIpClient(commKey, spec.Address, spec.Port, bufferSize); -// DeviceManager.AddDevice(tcp); -// return tcp; -// } - -// var com = properties["Com"]; -// if (com != null) -// { -// // Make the interim config object -// var comConfig = JsonConvert.DeserializeObject(com.ToString(), -// new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }); - -// // Get the IComPorts hardware device from the Device or Control System -// var comDev = comConfig.GetIComPortsDeviceFromManagedDevice(); -// if (comDev != null) -// { -// var controller = new ComPortController(commKey, comDev.ComPorts[comConfig.ComPortNumber], comConfig.ComSpec); -// DeviceManager.AddDevice(controller); -// return controller; -// } -// } -// Debug.Console(0, "No Tcp or Com port information for port {0}", commKey); -// return null; -// } - -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/DmFactory.cs b/PepperDashEssentials/Configuration Original/Factories/DmFactory.cs deleted file mode 100644 index ef2d1a03..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/DmFactory.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints.Receivers; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using Newtonsoft.Json.Linq; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices; -//using PepperDash.Essentials.Devices.Dm; -using PepperDash.Core; - -namespace PepperDash.Essentials -{ - public class DmFactory - { - public static Device Create(JToken devToken) - { - Device dev = null; - try - { - var devType = devToken.Value("type"); - var devKey = devToken.Value("key"); - var devName = devToken.Value("name"); - // Catch all 200 series TX - var devprops = devToken["properties"]; - var ipId = Convert.ToUInt32(devprops.Value("ipId"), 16); - var parent = devprops.Value("parent"); - if (parent == null) - parent = "controlSystem"; - - if (devType.StartsWith("DmTx2", StringComparison.OrdinalIgnoreCase)) - { - DmTx201C tx; - if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)) - { - tx = new DmTx201C(ipId, Global.ControlSystem); - //dev = new DmTx201SBasicController(devKey, devName, tx); - } - - } - else if (devType.StartsWith("DmRmc", StringComparison.OrdinalIgnoreCase)) - { - DmRmc100C rmc; - if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)) - { - rmc = new DmRmc100C(ipId, Global.ControlSystem); - //dev = new DmRmcBaseController(devKey, devName, rmc); - } - } - else - FactoryHelper.HandleUnknownType(devToken, devType); - } - catch (Exception e) - { - FactoryHelper.HandleDeviceCreationError(devToken, e); - } - return dev; - } - - - public static Device CreateChassis(JToken devToken) - { - Device dev = null; - try - { - var devType = devToken.Value("type"); - var devKey = devToken.Value("key"); - var devName = devToken.Value("name"); - // Catch all 200 series TX - var devprops = devToken["properties"]; - var ipId = Convert.ToUInt32(devprops.Value("ipId"), 16); - var parent = devprops.Value("parent"); - if (parent == null) - parent = "controlSystem"; - - if (devType.Equals("dmmd8x8", StringComparison.OrdinalIgnoreCase)) - { - var dm = new DmMd8x8(ipId, Global.ControlSystem); - //dev = new DmChassisController(devKey, devName, dm); - } - else if (devType.Equals("dmmd16x16", StringComparison.OrdinalIgnoreCase)) - { - var dm = new DmMd16x16(ipId, Global.ControlSystem); - //dev = new DmChassisController(devKey, devName, dm); - } - else if (devType.Equals("dmmd32x32", StringComparison.OrdinalIgnoreCase)) - { - var dm = new DmMd32x32(ipId, Global.ControlSystem); - //dev = new DmChassisController(devKey, devName, dm); - } - } - catch (Exception e) - { - FactoryHelper.HandleDeviceCreationError(devToken, e); - } - return dev; - } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs b/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs deleted file mode 100644 index 4f12b92f..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices; -using PepperDash.Core; - -namespace PepperDash.Essentials -{ - public static class FactoryHelper - { - public static string IrDriverPathPrefix = Global.FilePathPrefix + "IR" + Global.DirectorySeparator; - - public static void HandleUnknownType(JToken devToken, string type) - { - Debug.Console(0, "[Config] ERROR: Type '{0}' not found in group '{1}'", type, - devToken.Value("group")); - } - - public static void HandleDeviceCreationError(JToken devToken, Exception e) - { - Debug.Console(0, "[Config] ERROR creating device [{0}]: \r{1}", - devToken["key"].Value(), e); - Debug.Console(0, "Relevant config:\r{0}", devToken.ToString(Newtonsoft.Json.Formatting.Indented)); - } - - /// - /// Finds either the ControlSystem or a device controller that contains IR ports and - /// returns a port from the hardware device - /// - /// - /// Crestron IrPort or null if device doesn't have IR or is not found - public static IrOutPortConfig GetIrPort(JToken propsToken) - { - var irSpec = propsToken["control"]["irSpec"]; - var portDevKey = irSpec.Value("portDeviceKey"); - var portNum = irSpec.Value("portNumber"); - IIROutputPorts irDev = null; - if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) - || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) - irDev = Global.ControlSystem; - else - irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; - - if (irDev == null) - { - Debug.Console(0, "[Config] Error, device with IR ports '{0}' not found", portDevKey); - return null; - } - - if (portNum <= irDev.NumberOfIROutputPorts) // success! - { - var file = IrDriverPathPrefix + irSpec["file"].Value(); - return new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file }; - } - else - { - Debug.Console(0, "[Config] Error, device '{0}' IR port {1} out of range", - portDevKey, portNum); - return null; - } - } - - - /// - /// Finds either the ControlSystem or a device controller that contains com ports and - /// returns a port from the hardware device - /// - /// The Properties token from the device's config - /// Crestron ComPort or null if device doesn't have IR or is not found - public static ComPort GetComPort(JToken propsToken) - { - var portDevKey = propsToken.Value("comPortDevice"); - var portNum = propsToken.Value("comPortNumber"); - IComPorts comDev = null; - if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)) - comDev = Global.ControlSystem; - else - comDev = DeviceManager.GetDeviceForKey(portDevKey) as IComPorts; - - if (comDev == null) - { - Debug.Console(0, "[Config] Error, device with com ports '{0}' not found", portDevKey); - return null; - } - - if (portNum <= comDev.NumberOfComPorts) // success! - return comDev.ComPorts[portNum]; - else - { - Debug.Console(0, "[Config] Error, device '{0}' com port {1} out of range", - portDevKey, portNum); - return null; - } - } - - /// - /// Returns the key if it exists or converts the name into a key - /// - public static string KeyOrConvertName(string key, string name) - { - if (string.IsNullOrEmpty(key)) - return name.Replace(' ', '-'); - return key; - } - } - - /// - /// Wrapper to help in IR port creation - /// - public class IrOutPortConfig - { - public IROutputPort Port { get; set; } - public string FileName { get; set; } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/MAYBE SetTopBoxFactory.cs b/PepperDashEssentials/Configuration Original/Factories/MAYBE SetTopBoxFactory.cs deleted file mode 100644 index d3345762..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/MAYBE SetTopBoxFactory.cs +++ /dev/null @@ -1,52 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; - -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; - -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class SetTopBoxFactory -// { -// public static Device Create(JToken devToken) -// { -// Device dev = null; -// try -// { -// var devType = devToken.Value("type"); -// var devKey = devToken.Value("key"); -// var devName = devToken.Value("name"); -// var props = devToken["properties"]; -// var portConfig = FactoryHelper.GetIrPort(props); -// if (portConfig != null) -// { -// if (devType.EndsWith("-generic")) -// { -// var stb = new IrSetTopBoxBase(devKey, devName, portConfig.Port, portConfig.FileName); -// // Do this a better way? -// stb.HasDpad = props["hasDpad"].Value(); -// stb.HasDvr = props["hasDvr"].Value(); -// stb.HasNumbers = props["hasNumbers"].Value(); -// stb.HasPreset = props["hasPresets"].Value(); -// dev = stb; -// } -// else -// FactoryHelper.HandleUnknownType(devToken, devType); - -// var preDev = dev as IHasSetTopBoxProperties; -// if(preDev.HasPreset) -// preDev.LoadPresets(props["presetListName"].Value()); -// } -// } -// catch (Exception e) -// { -// FactoryHelper.HandleDeviceCreationError(devToken, e); -// } -// return dev; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/PcFactory.cs b/PepperDashEssentials/Configuration Original/Factories/PcFactory.cs deleted file mode 100644 index c8413321..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/PcFactory.cs +++ /dev/null @@ -1,34 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; - -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class PcFactory -// { -// public static Device Create(JToken devToken) -// { -// Device dev = null; -// //try -// //{ -// // var devType = devToken.Value("type"); -// // var devKey = devToken.Value("key"); -// // var devName = devToken.Value("name"); -// // if (devType.Equals("laptop", StringComparison.OrdinalIgnoreCase)) -// // dev = new Laptop(devKey, devName); -// // else -// // FactoryHelper.HandleUnknownType(devToken, devType); -// //} -// //catch (Exception e) -// //{ -// // FactoryHelper.HandleDeviceCreationError(devToken, e); -// //} -// return dev; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/REMOVE DiscPlayerFactory.cs b/PepperDashEssentials/Configuration Original/Factories/REMOVE DiscPlayerFactory.cs deleted file mode 100644 index d19dc0c7..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/REMOVE DiscPlayerFactory.cs +++ /dev/null @@ -1,46 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; - -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class DiscPlayerFactory -// { -// public static Device Create(JToken devToken) -// { -// Device dev = null; -// try -// { -// var devType = devToken.Value("type"); -// var devKey = devToken.Value("key"); -// var devName = devToken.Value("name"); - -// // Filter out special (Pioneer -// //(devType.Equals("genericIr", StringComparison.OrdinalIgnoreCase)) - -// var props = devToken["properties"]; -// var portConfig = FactoryHelper.GetIrPort(props); -// if (portConfig != null) -// { -// if (devType.EndsWith("-generic")) -// dev = new IrDvdBase(devKey, devName, portConfig.Port, portConfig.FileName); -// else -// FactoryHelper.HandleUnknownType(devToken, devType); -// } - -// // NO PORT ERROR HERE?? - -// } -// catch (Exception e) -// { -// FactoryHelper.HandleDeviceCreationError(devToken, e); -// } -// return dev; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/RemoteFactory.cs b/PepperDashEssentials/Configuration Original/Factories/RemoteFactory.cs deleted file mode 100644 index c28d1da7..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/RemoteFactory.cs +++ /dev/null @@ -1,127 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.Remotes; -//using Crestron.SimplSharpPro.UI; -//using Newtonsoft.Json; -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -////using PepperDash.Essentials.Remotes; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// //public class RemoteFactory -// //{ -// // public static Device Create(JToken devToken) -// // { -// // Hr150Controller dev = null; -// // try -// // { -// // var devType = devToken.Value("type"); -// // var devKey = devToken.Value("key"); -// // var devName = devToken.Value("name"); -// // var props = devToken["properties"]; - -// // if (devType.Equals("hr150", StringComparison.OrdinalIgnoreCase)) -// // { -// // uint id = Convert.ToUInt32(props.Value("rfId"), 16); -// // var parent = props.Value("rfGateway"); -// // RFExGateway rf = GetGateway(parent); - -// // var hw = new Hr150(id, rf); -// // dev = new Hr150Controller(devKey, devName, hw); - -// // // Have to add the buttons and default source after all devices are spun up -// // dev.AddPostActivationAction(() => -// // { -// // var defaultSystemKey = props.Value("defaultSystemKey"); -// // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey)); - -// // // Link custom buttons -// // var buttonProps = JsonConvert.DeserializeObject>(props["buttons"].ToString()); -// // foreach (var kvp in buttonProps) -// // { -// // var split = kvp.Value.Split(':'); -// // if (split[0].Equals("source")) -// // { -// // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource; -// // if (src == null) -// // { -// // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]); -// // continue; -// // } -// // dev.SetCustomButtonAsSource(kvp.Key, src); -// // } -// // else if (split[0] == "room") -// // { -// // if (split[1] == "off") -// // dev.SetCustomButtonAsRoomOff(kvp.Key); -// // } -// // } -// // }); -// // } -// // else if (devType.Equals("tsr302", StringComparison.OrdinalIgnoreCase)) -// // { -// // uint id = Convert.ToUInt32(props.Value("rfId"), 16); -// // var parent = props.Value("rfGateway"); -// // RFExGateway rf = GetGateway(parent); -// // var sgd = props.Value("sgdPath"); - -// // var hw = new Tsr302(id, rf); - -// // //dev = new Hr150Controller(devKey, devName, hw); - -// // //// Have to add the buttons and default source after all devices are spun up -// // //dev.AddPostActivationAction(() => -// // //{ -// // // var defaultSystemKey = props.Value("defaultSystemKey"); -// // // dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey)); - -// // // // Link custom buttons -// // // var buttonProps = JsonConvert.DeserializeObject>(props["buttons"].ToString()); -// // // foreach (var kvp in buttonProps) -// // // { -// // // var split = kvp.Value.Split(':'); -// // // if (split[0].Equals("source")) -// // // { -// // // var src = DeviceManager.GetDeviceForKey(split[1]) as IPresentationSource; -// // // if (src == null) -// // // { -// // // Debug.Console(0, dev, "Error: Cannot add source key '{0}'", split[1]); -// // // continue; -// // // } -// // // dev.SetCustomButtonAsSource(kvp.Key, src); -// // // } -// // // else if (split[0] == "room") -// // // { -// // // if (split[1] == "off") -// // // dev.SetCustomButtonAsRoomOff(kvp.Key); -// // // } -// // // } -// // //}); -// // } -// // } -// // catch (Exception e) -// // { -// // FactoryHelper.HandleDeviceCreationError(devToken, e); -// // } -// // return dev; -// // } - -// // public static RFExGateway GetGateway(string parent) -// // { -// // if (parent == null) -// // parent = "controlSystem"; -// // RFExGateway rf = null; -// // if (parent.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) -// // || parent.Equals("processor", StringComparison.OrdinalIgnoreCase)) -// // { -// // rf = Global.ControlSystem.ControllerRFGatewayDevice; -// // } -// // return rf; -// // } -// //} -//} \ No newline at end of file diff --git a/PepperDashEssentials/Configuration Original/Factories/TouchpanelFactory.cs b/PepperDashEssentials/Configuration Original/Factories/TouchpanelFactory.cs deleted file mode 100644 index 024bc083..00000000 --- a/PepperDashEssentials/Configuration Original/Factories/TouchpanelFactory.cs +++ /dev/null @@ -1,48 +0,0 @@ -//using System; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.UI; - -//using Newtonsoft.Json.Linq; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Devices; -//using PepperDash.Core; - -//namespace PepperDash.Essentials -//{ -// public class TouchpanelFactory -// { -// public static Device Create(JToken devToken) -// { -// SmartGraphicsTouchpanelControllerBase dev = null; -// try -// { -// var devType = devToken.Value("type"); -// var devKey = devToken.Value("key"); -// var devName = devToken.Value("name"); -// var props = devToken["properties"]; -// if (devType.Equals("Tsw1052", StringComparison.OrdinalIgnoreCase)) -// { -// uint ipId = Convert.ToUInt32(props.Value("ipId"), 16); -// var hw = new Tsw1052(ipId, Global.ControlSystem); -// dev = TouchpanelControllerFactory.Create(devKey, devName, hw, props.Value("sgdPath")); -// dev.UsesSplashPage = props.Value("usesSplashPage"); -// dev.ShowDate = props.Value("showDate"); -// dev.ShowTime = props.Value("showTime"); - -// // This plugs the system key into the tp, but it won't be linked up until later -// dev.AddPostActivationAction(() => -// { -// var defaultSystemKey = props.Value("defaultSystemKey"); -// dev.SetCurrentRoom((EssentialsRoom)DeviceManager.GetDeviceForKey(defaultSystemKey)); -// }); -// } -// } -// catch (Exception e) -// { -// FactoryHelper.HandleDeviceCreationError(devToken, e); -// } -// return dev; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 4cb58a24..a88d932b 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -25,8 +25,6 @@ namespace PepperDash.Essentials { HttpLogoServer LogoServer; - List FactoryObjects = new List(); - public ControlSystem() : base() { @@ -36,7 +34,7 @@ namespace PepperDash.Essentials } /// - /// Git 'er goin' + /// Entry point for the program /// public override void InitializeSystem() { @@ -95,17 +93,19 @@ namespace PepperDash.Essentials var dirSeparator = Global.DirectorySeparator; - var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version; - - var versionString = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build); - string directoryPrefix; directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(); - if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows OS + var fullVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false); + + AssemblyInformationalVersionAttribute fullVersionAtt = fullVersion[0] as AssemblyInformationalVersionAttribute; + + Global.SetAssemblyVersion(fullVersionAtt.InformationalVersion); + + if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows CE OS { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", Global.AssemblyVersion); // Check if User/ProgramX exists if (Directory.Exists(directoryPrefix + dirSeparator + "User" @@ -133,7 +133,7 @@ namespace PepperDash.Essentials } else // Handles Linux OS (Virtual Control) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", Global.AssemblyVersion); // Set path to User/ filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator; @@ -148,7 +148,7 @@ namespace PepperDash.Essentials } /// - /// Do it, yo + /// Begins the process of loading resources including plugins and configuration data /// public void GoWithLoad() { @@ -175,23 +175,21 @@ namespace PepperDash.Essentials else { Debug.Console(0, - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "Essentials file structure setup completed.\r" + - "Please load config, sgd and ir files and\r" + - "restart program.\r" + - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "------------------------------------------------"); + @"---------------------------------------------- + ------------------------------------------------ + ------------------------------------------------ + Essentials file structure setup completed. + Please load config, sgd and ir files and + restart program. + ------------------------------------------------ + ------------------------------------------------ + ------------------------------------------------"); } } catch (Exception e) { Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e); - - } // Notify the OS that the program intitialization has completed @@ -200,7 +198,7 @@ namespace PepperDash.Essentials } /// - /// Initial simple implementation. Reads user/programN/plugins folder and + /// Initial simple implementation. Reads user/programXX/plugins folder and /// use /// void LoadPlugins() @@ -254,7 +252,42 @@ namespace PepperDash.Essentials var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin")); if (loadPlugin != null) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName); + Debug.Console(2, "LoadPlugin method found in {0}", type.Name); + + var fields = type.GetFields(BindingFlags.Public | BindingFlags.Static); + + var minimumVersion = fields.FirstOrDefault(p => p.Name.Equals("MinimumEssentialsFrameworkVersion")); + if (minimumVersion != null) + { + Debug.Console(2, "MinimumEssentialsFrameworkVersion found"); + + var minimumVersionString = minimumVersion.GetValue(null) as string; + + if (!string.IsNullOrEmpty(minimumVersionString)) + { + var passed = Global.IsRunningMinimumVersionOrHigher(minimumVersionString); + + if (!passed) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Plugin indicates minimum Essentials version {0}. Dependency check failed. Skipping Plugin", minimumVersionString); + continue; + } + else + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Passed plugin passed dependency check (required version {0})", minimumVersionString); + } + } + else + { + Debug.Console(0, Debug.ErrorLogLevel.Warning, "MinimumEssentialsFrameworkVersion found but not set. Loading plugin, but your mileage may vary."); + } + } + else + { + Debug.Console(0, Debug.ErrorLogLevel.Warning, "MinimumEssentialsFrameworkVersion not found. Loading plugin, but your mileage may vary."); + } + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding plugin: {0}", assy.Key); loadPlugin.Invoke(null, null); } } @@ -303,18 +336,6 @@ namespace PepperDash.Essentials return configExists; } - ///// - ///// - ///// - ///// - //public void EnablePortalSync(string s) - //{ - // if (s.ToLower() == "enable") - // { - // CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled"); - // } - //} - /// /// /// diff --git a/PepperDashEssentials/Devices/DiscPlayer/OppoExtendedBdp.cs b/PepperDashEssentials/Devices/DiscPlayer/OppoExtendedBdp.cs deleted file mode 100644 index e57e34a3..00000000 --- a/PepperDashEssentials/Devices/DiscPlayer/OppoExtendedBdp.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices -{ - ///// - ///// This DVD class should cover most IR, one-way DVD and Bluray fuctions - ///// - //public class OppoBluray : IrDvdBase, IDvdControls, IExtendedOutputs - //{ - // public OppoBluray(string key, string name, IROutputPort port, string irDriverFilepath) : base(key, name, port, irDriverFilepath) { } - - - - // public OutputsToTriListBridge GetExtendedOutputsToTriListBridge() - // { - // return new ExtendedDvdTriListBridge(); - // } - - - //} - - //public class ExtendedDvdTriListBridge : OutputsToTriListBridge - //{ - - // public override void Link() - // { - // throw new NotImplementedException(); - // } - - // public override void UnLink() - // { - // throw new NotImplementedException(); - // } - //} -} \ No newline at end of file diff --git a/PepperDashEssentials/Devices/NUMERIC AppleTV.cs b/PepperDashEssentials/Devices/NUMERIC AppleTV.cs deleted file mode 100644 index 9ce4e5de..00000000 --- a/PepperDashEssentials/Devices/NUMERIC AppleTV.cs +++ /dev/null @@ -1,45 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; - -//using PepperDash.Essentials.Core; - -//namespace PepperDash.Essentials.Devices -//{ -// public class AppleTV : Device, IHasCueActionList -// { -// public IrOutputPortController IrPort { get; private set; } - -// public AppleTV(string key, string name, IROutputPort port, string irDriverFilepath) -// : base(key, name) -// { -// IrPort = new IrOutputPortController("ir" + key, port, irDriverFilepath); -// } - -// #region IFunctionList Members -// public List CueActionList -// { -// get -// { -// var numToIr = new Dictionary -// { -// { CommonBoolCue.Menu, IROutputStandardCommands.IROut_MENU }, -// { CommonBoolCue.Up, IROutputStandardCommands.IROut_UP_ARROW }, -// { CommonBoolCue.Down, IROutputStandardCommands.IROut_DN_ARROW }, -// { CommonBoolCue.Left, IROutputStandardCommands.IROut_LEFT_ARROW }, -// { CommonBoolCue.Right, IROutputStandardCommands.IROut_RIGHT_ARROW }, -// { CommonBoolCue.Select, IROutputStandardCommands.IROut_ENTER } -// }; -// var funcs = new List(numToIr.Count); - -// foreach (var kvp in numToIr) -// funcs.Add(new BoolCueActionPair(kvp.Key, b => IrPort.PressRelease(kvp.Value, b))); -// return funcs; -// } -// } -// #endregion -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json b/PepperDashEssentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json new file mode 100644 index 00000000..3e43dac6 --- /dev/null +++ b/PepperDashEssentials/Example Configuration/EssentialsHuddleSpaceRoom/configurationFile-HuddleSpace-2-Source.json @@ -0,0 +1,232 @@ +{ + "system": {}, + "system_url": "", + "template_url": "", + "template": { + "sourceLists": { + "default": { + "source-2": { + "order": 6, + "type": "route", + "altIcon": "Blank", + "icon": "", + "sourceKey": "wePresent-1", + "includeInSourceList": true, + "volumeControlKey": "$defaultAudio", + "routeList": [ + { + "sourceKey": "wePresent-1", + "type": "audioVideo", + "destinationKey": "$defaultAll" + } + ] + }, + "source-1": { + "order": 5, + "type": "route", + "altIcon": "Blank", + "icon": "", + "sourceKey": "inRoomPc-1", + "includeInSourceList": true, + "volumeControlKey": "$defaultAudio", + "routeList": [ + { + "sourceKey": "inRoomPc-1", + "type": "audioVideo", + "destinationKey": "$defaultAll" + } + ] + }, + "roomOff": { + "sourceKey": "$off", + "type": "off", + "routeList": [ + { + "sourceKey": "$off", + "type": "audioVideo", + "destinationKey": "$defaultAll" + } + ] + } + } + }, + "devices": [ + { + "name": "RMC3", + "group": "processor", + "properties": { + "numberOfIrPorts": 2, + "numberOfComPorts": 1 + }, + "supportedSystemTypes": [ + "hudType", + "presType", + "vtcType", + "custom" + ], + "type": "rmc3", + "supportedConfigModes": [ + "compliance", + "essentials" + ], + "supportsCompliance": true, + "key": "processor", + "uid": 0 + }, + { + "name": "Room PC", + "key": "inRoomPc-1", + "type": "inRoomPc", + "group": "pc", + "uid": 8, + "properties": { + "hasAudio": true, + "hasControls": false, + "isDefault": true + } + }, + { + "name": "Wireless Video", + "key": "wePresent-1", + "type": "wePresent", + "group": "genericSource", + "uid": 9, + "properties": { + "isDefault": false + } + }, + { + "name": "Samsung QM Series Display", + "key": "display-1", + "type": "samsungmdc", + "group": "display", + "uid": 11, + "properties": { + "id": "01", + "control": { + "controlPortDevKey": "processor", + "comParams": { + "parity": "None", + "protocol": "RS232", + "baudRate": 9600, + "softwareHandshake": "None", + "dataBits": 8, + "hardwareHandshake": "None", + "stopBits": 1 + }, + "controlPortNumber": 1, + "method": "com" + } + } + }, + { + "name": "TSW-760", + "key": "tsw760-1", + "type": "tsw760", + "group": "touchpanel", + "uid": 14, + "properties": { + "control": { + "method": "ipid", + "ipid": "03", + "params": { + "deviceReadyResponsePattern": ".*>", + "endOfLineString": "\n" + } + }, + "showVolumeGauge": true, + "roomListKey": "", + "showDate": true, + "headerStyle": "Verbose", + "sgdFile": "PepperDash Essentials TSW-760.sgd", + "showTime": true, + "sourcesOverflowCount": 4, + "usesSplashPage": false, + "defaultRoomKey": "room1" + } + }, + { + "name": "iPad", + "key": "crestronApp-1", + "type": "crestronApp", + "group": "touchpanel", + "uid": 15, + "properties": { + "control": { + "method": "ipid", + "ipid": "04", + "params": { + "deviceReadyResponsePattern": ".*>", + "endOfLineString": "\n" + } + }, + "showVolumeGauge": true, + "roomListKey": "", + "showDate": false, + "headerStyle": "Verbose", + "sgdFile": "PepperDash Essentials iPad.sgd", + "showTime": false, + "sourcesOverflowCount": 5, + "projectName": "PepperDash Essentials iPad", + "defaultRoomKey": "room1", + "usesSplashPage": false + } + } + ], + "info": { + "processorType": "rmc3", + "lastUid": 16, + "lastModifiedDate": "2018-02-16T17:54:41.315Z", + "systemType": "huddle", + "comment": "", + "requiredControlSofwareVersion": "" + }, + "tieLines": [ + { + "sourceKey": "inRoomPc-1", + "sourcePort": "anyVideoOut", + "destinationKey": "display-1", + "destinationPort": "HdmiIn1", + "type": "audioVideo" + }, + { + "sourceKey": "wePresent-1", + "sourcePort": "anyOut", + "destinationKey": "display-1", + "destinationPort": "HdmiIn2", + "type": "audioVideo" + } + ], + "rooms": [ + { + "type": "huddle", + "name": "Essentials Huddle 2 Inputs", + "key": "room1", + "properties": { + "defaultDisplayKey": "display-1", + "logo": { + "type": "system", + "url": "" + }, + "description": "Huddle Space with 2 sources. RMC3 processor. iPad + TSW-560", + "defaultSourceItem": "source-1", + "hasDsp": false, + "helpMessage": "", + "sourceListKey": "default", + "volumes": { + "master": { + "level": 40, + "deviceKey": "display-1", + "label": "Volume" + } + }, + "defaultAudioKey": "display-1", + "defaultVideoBehavior": "basic", + "tech": { + "password": "1234" + } + } + } + ] + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Example Configuration/EssentialsHuddleVtc1Room/configurationFile-mockVideoCodec_din-ap3_-_dm4x1.json b/PepperDashEssentials/Example Configuration/EssentialsHuddleVtc1Room/configurationFile-mockVideoCodec_din-ap3_-_dm4x1.json new file mode 100644 index 00000000..7cc97c47 --- /dev/null +++ b/PepperDashEssentials/Example Configuration/EssentialsHuddleVtc1Room/configurationFile-mockVideoCodec_din-ap3_-_dm4x1.json @@ -0,0 +1,387 @@ +{ + "system": { + "rooms": [ + { + "name": "Example Room", + "key": "room1", + "properties": { + "occupancy": { + "timeoutMinutes": "60" + } + } + } + ], + "devices": [ + { + "key": "hdMd4x14kE-1", + "uid": 4, + "properties": { + "control": { + "tcpSshProperties": { + "address": "0.0.0.0" + } + } + } + }, + { + "key": "mockCodec-1", + "uid": 5, + "properties": { + "control": { + "tcpSshProperties": { + "address": "0.0.0.0" + } + } + } + } + ], + "info": { + "lastModifiedDate": "2019-02-26T21:08:09.195Z" + } + }, + "system_url": "", + "template_url": "", + "template": { + "rooms": [ + { + "type": "huddleVtc1", + "name": "Essentials DIN-AP3 - DM4x1", + "key": "room1", + "properties": { + "defaultDisplayKey": "display-1", + "description": "", + "helpMessage": "", + "sourceListKey": "default", + "defaultVideoBehavior": "basic", + "logo": { + "type": "system", + "url": "" + }, + "occupancy": { + "timeoutMinutes": "60", + "deviceKey": "glsOdtCCn-1" + }, + "defaultSourceItem": "source-1", + "videoCodecKey": "mockCodec-1", + "hasDsp": false, + "volumes": { + "master": { + "level": 40, + "deviceKey": "mockCodec-1", + "label": "Volume" + } + }, + "defaultAudioKey": "display-1", + "tech": { + "password": "1234" + } + } + } + ], + "devices": [ + { + "name": "DIN-AP3", + "key": "processor", + "type": "dinAp3", + "group": "processor", + "uid": 0, + "properties": { + } + }, + { + "name": "Room PC", + "key": "inRoomPc-1", + "type": "inRoomPc", + "properties": { + "hasAudio": true, + "hasControls": false, + "isDefault": true + }, + "group": "pc", + "uid": 1 + }, + { + "name": "Laptop", + "key": "laptop-1", + "type": "laptop", + "properties": { + "hasAudio": true, + "hasControls": false + }, + "group": "pc", + "uid": 2 + }, + { + "name": "Wireless Video", + "key": "wePresent-1", + "type": "wePresent", + "properties": {}, + "group": "genericSource", + "uid": 3 + }, + { + "name": "HD-MD4x1-4k-E HDMI Switch 1", + "key": "hdMd4x14kE-1", + "type": "hdMd4x14kE", + "properties": { + "control": { + "params": { + "deviceReadyResponsePattern": ".*>", + "endOfLineString": "\n" + }, + "ipid": "10", + "method": "ipidTcp", + "tcpSshProperties": { + "port": 0, + "address": "" + } + }, + "parentDeviceKey": "processor", + "inputs": { + "hdmiIn2": { + "disableHdcp": true + }, + "hdmiIn3": { + "disableHdcp": true + }, + "hdmiIn4": { + "disableHdcp": true + }, + "hdmiIn1": { + "disableHdcp": true + } + } + }, + "group": "hdMdSwitch", + "uid": 4 + }, + { + "name": "Mock Video Codec 1", + "key": "mockCodec-1", + "type": "mockVc", + "properties": { + "favorites": [ + { + "name": "Corporate WebEx", + "number": "5555555555" + } + ] + }, + "group": "videoCodec", + "uid": 5 + }, + { + "name": "Samsung MDC Protocol 1", + "key": "display-1", + "type": "samsungmdc", + "properties": { + "id": "01", + "control": { + "controlPortDevKey": "processor", + "controlPortNumber": 1, + "method": "com", + "comParams": { + "protocol": "RS232", + "baudRate": 9600, + "hardwareHandshake": "None", + "softwareHandshake": "None", + "dataBits": 8, + "parity": "None", + "stopBits": 1 + } + } + }, + "group": "display", + "uid": 6 + }, + { + "name": "Crestron GLS-ODT-C-CN 1", + "key": "glsOdtCCn-1", + "type": "glsOdtCCn", + "properties": { + "control": { + "method": "cresnet", + "cresnetId": "97" + } + }, + "group": "occupancy", + "uid": 7 + }, + { + "name": "TSW-760", + "key": "tsw760-1", + "type": "tsw760", + "properties": { + "control": { + "params": { + "deviceReadyResponsePattern": ".*>", + "endOfLineString": "\n" + }, + "ipid": "03", + "method": "ipid" + }, + "showVolumeGauge": true, + "sourcesOverflowCount": 4, + "showDate": true, + "headerStyle": "Verbose", + "sgdFile": "PepperDash Essentials TSW-760.sgd", + "showTime": true, + "roomListKey": "", + "usesSplashPage": false, + "defaultRoomKey": "room1" + }, + "group": "touchpanel", + "uid": 8 + }, + { + "name": "Crestron XPanel", + "key": "crestronApp-1", + "type": "crestronApp", + "properties": { + "control": { + "params": { + "deviceReadyResponsePattern": ".*>", + "endOfLineString": "\n" + }, + "ipid": "04", + "method": "ipid" + }, + "showVolumeGauge": true, + "sourcesOverflowCount": 5, + "showDate": true, + "headerStyle": "Verbose", + "sgdFile": "PepperDash Essentials iPad.sgd", + "showTime": true, + "roomListKey": "", + "projectName": "PepperDash Essentials iPad", + "defaultRoomKey": "room1", + "usesSplashPage": false + }, + "group": "touchpanel", + "uid": 9 + } + ], + "info": { + "comment": "", + "lastUid": 10, + "lastModifiedDate": "2018-07-02T17:41:06.550Z", + "systemType": "huddle", + "processorType": "dinAp3", + "requiredControlSofwareVersion": "" + }, + "tieLines": [ + { + "type": "audioVideo", + "sourceKey": "hdMd4x14kE-1", + "destinationKey": "mockCodec-1", + "destinationPort": "HdmiIn2", + "sourcePort": "hdmiOut" + }, + { + "type": "audioVideo", + "sourceKey": "mockCodec-1", + "destinationKey": "display-1", + "destinationPort": "HdmiIn1", + "sourcePort": "HdmiOut1" + }, + { + "type": "audioVideo", + "sourceKey": "laptop-1", + "destinationKey": "hdMd4x14kE-1", + "destinationPort": "hdmiIn1", + "sourcePort": "anyOut" + }, + { + "type": "audioVideo", + "sourceKey": "inRoomPc-1", + "destinationKey": "mockCodec-1", + "destinationPort": "HdmiIn3", + "sourcePort": "anyVideoOut" + }, + { + "type": "audioVideo", + "sourceKey": "wePresent-1", + "destinationKey": "hdMd4x14kE-1", + "destinationPort": "hdmiIn2", + "sourcePort": "anyOut" + } + ], + "sourceLists": { + "default": { + "source-2": { + "order": 6, + "icon": "", + "altIcon": "Blank", + "type": "route", + "sourceKey": "laptop-1", + "includeInSourceList": true, + "volumeControlKey": "$defaultAudio", + "routeList": [ + { + "type": "audioVideo", + "sourceKey": "laptop-1", + "destinationKey": "$defaultAll" + } + ] + }, + "source-3": { + "order": 7, + "icon": "", + "altIcon": "Blank", + "type": "route", + "sourceKey": "wePresent-1", + "includeInSourceList": true, + "volumeControlKey": "$defaultAudio", + "routeList": [ + { + "type": "audioVideo", + "sourceKey": "wePresent-1", + "destinationKey": "$defaultAll" + } + ] + }, + "source-1": { + "order": 5, + "icon": "", + "altIcon": "Blank", + "type": "route", + "sourceKey": "inRoomPc-1", + "includeInSourceList": true, + "volumeControlKey": "$defaultAudio", + "routeList": [ + { + "type": "audioVideo", + "sourceKey": "inRoomPc-1", + "destinationKey": "$defaultAll" + } + ] + }, + "roomOff": { + "type": "off", + "sourceKey": "$off", + "routeList": [ + { + "type": "audioVideo", + "sourceKey": "$off", + "destinationKey": "$defaultAll" + } + ] + }, + "codecOsd": { + "order": 1, + "name": "None", + "type": "route", + "includeInSourceList": true, + "sourceKey": "", + "routeList": [ + { + "type": "audioVideo", + "sourceKey": "mockCodec-1[osd]", + "destinationKey": "$defaultAll" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json b/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json new file mode 100644 index 00000000..3fb02ce8 --- /dev/null +++ b/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json @@ -0,0 +1,439 @@ +{ + "system_url": "", + "template": { + "info": { + "comment": "", + "requiredControlSofwareVersion": "", + "systemType": "huddle", + "lastModifiedDate": "2018-07-09T20:00:47.873Z", + "lastUid": 23, + "processorType": "rmc3" + }, + "devices": [ + { + "key": "processor", + "group": "processor", + "uid": 0, + "supportsCompliance": true, + "type": "rmc3", + "properties": {}, + "name": "RMC3" + }, + { + "key": "comm-1", + "uid": 1, + "name": "Generic comm 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "comParams": { + "hardwareHandshake": "None", + "parity": "None", + "protocol": "RS232", + "baudRate": 9600, + "dataBits": 8, + "softwareHandshake": "None", + "stopBits": 1 + }, + "controlPortNumber": 1, + "controlPortDevKey": "processor", + "method": "Com" + } + } + }, + { + "key": "tcp-1", + "uid": 2, + "name": "Generic TCP 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "tcpSshProperties": { + "username": "", + "autoReconnect": true, + "AutoReconnectIntervalMs": 2000, + "port": 23, + "address": "0.0.0.0", + "password": "" + }, + "method": "Tcpip" + } + } + }, + { + "key": "ssh-1", + "uid": 3, + "name": "Generic SSH 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "tcpSshProperties": { + "username": "crestron", + "autoReconnect": true, + "AutoReconnectIntervalMs": 2000, + "port": 22, + "address": "10.11.50.135", + "password": "2H3Zu&OvgXp6" + }, + "method": "Ssh" + } + } + }, + { + "key": "eisc-1A", + "uid": 4, + "type": "eiscApi", + "group": "api", + "properties": { + "control": { + "tcpSshProperties": { + "address": "127.0.0.2", + "port": 0 + }, + "ipId": "1A" + }, + "devices": [ + { + "deviceKey": "comm-1", + "joinStart": 3001 + }, + { + "deviceKey": "tcp-1", + "joinStart": 3011 + }, + { + "deviceKey": "ssh-1", + "joinStart": 3021 + }, + { + "deviceKey": "dmMd8x8-1", + "joinStart": 1 + }, + { + "deviceKey": "dmTx201C-1", + "joinStart": 3051 + }, + { + "deviceKey": "dmRmc4kScalerC-1", + "joinStart": 3061 + }, + { + "deviceKey": "dmRmc200C-1", + "joinStart": 3071 + }, + { + "deviceKey": "dmRmc100C-1", + "joinStart": 3081 + }, + { + "deviceKey": "comm-2", + "joinStart": 2501 + }, + { + "deviceKey": "comm-3", + "joinStart": 2511 + }, + { + "deviceKey": "comm-4", + "joinStart": 2521 + }, + { + "deviceKey": "cec-1", + "joinStart": 2531 + }, + { + "deviceKey": "cec-2", + "joinStart": 2541 + }, + { + "deviceKey": "cec-3", + "joinStart": 2551 + }, + { + "deviceKey": "cec-4", + "joinStart": 2561 + }, + { + "deviceKey": "cec-5", + "joinStart": 2571 + }, + { + "deviceKey": "cec-6", + "joinStart": 2581 + }, + { + "deviceKey": "cec-7", + "joinStart": 2591 + }, + { + "deviceKey": "gls-oir-1", + "joinStart": 2701 + }, + { + "deviceKey": "gls-odt-1", + "joinStart": 2751 + } + ] + } + }, + { + "key": "dmMd8x8-1", + "uid": 5, + "name": "DM-MD8x8 Chassis 1", + "type": "dmMd8x8", + "group": "dmChassis", + "properties": { + "control": { + "method": "ipid", + "ipid": "40", + "params": { + "endOfLineString": "\n", + "deviceReadyResponsePattern": ".*>" + } + }, + "volumeControls": {}, + "inputSlots": { + "1": "dmcHdDsp", + "2": "dmcHdDsp", + "3": "dmcDvi", + "4": "dmcDvi", + "5": "dmcC", + "6": "dmcCDsp" + }, + "outputSlots": { + "1": "dmcCoHd", + "2": "dmcCoHd" + }, + "inputNames": { + "1": "Input 1", + "2": "Input 2", + "3": "Input 3", + "4": "Input 4", + "5": "Input 5", + "6": "Input 6" + }, + "parentDeviceKey": "processor", + "outputNames": { + "1": "Output 1", + "2": "Output 2", + "3": "Output 3", + "4": "Output 4" + } + } + }, + { + "key": "dmTx201C-1", + "uid": 6, + "name": "DM-TX-201C 1", + "type": "dmTx201C", + "group": "dmEndpoint", + "properties": { + "control": { + "method": "ipid", + "ipid": "45", + "params": { + "endOfLineString": "\n", + "deviceReadyResponsePattern": ".*>" + } + }, + "parentDeviceKey": "dmMd8x8-1", + "parentInputNumber": "5" + } + }, + { + "key": "dmRmc4kScalerC-1", + "uid": 7, + "name": "DM-RMC-4K-SCALER-C Out 1", + "type": "dmRmc4kScalerC", + "group": "dmEndpoint", + "properties": { + "control": { + "method": "ipid", + "ipid": "61", + "params": { + "endOfLineString": "\n", + "deviceReadyResponsePattern": ".*>" + } + }, + "parentDeviceKey": "dmMd8x8-1", + "parentOutputNumber": "1" + } + }, + { + "key": "dmRmc200C-1", + "uid": 8, + "name": "DM-RMC-200-C Out 2", + "type": "dmRmc200C", + "group": "dmEndpoint", + "properties": { + "control": { + "method": "ipid", + "ipid": "62", + "params": { + "endOfLineString": "\n", + "deviceReadyResponsePattern": ".*>" + } + }, + "parentDeviceKey": "dmMd8x8-1", + "parentOutputNumber": "2" + } + }, + { + "key": "dmRmc100C-1", + "uid": 9, + "name": "DM-RMC-100-C Out 3", + "type": "dmRmc100C", + "group": "dmEndpoint", + "properties": { + "control": { + "method": "ipid", + "ipid": "63", + "params": { + "endOfLineString": "\n", + "deviceReadyResponsePattern": ".*>" + } + }, + "parentDeviceKey": "dmMd8x8-1", + "parentOutputNumber": "3" + } + }, + { + "key": "comm-2", + "uid": 10, + "name": "Rmc comm 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "comParams": { + "hardwareHandshake": "None", + "parity": "None", + "protocol": "RS232", + "baudRate": 9600, + "dataBits": 8, + "softwareHandshake": "None", + "stopBits": 1 + }, + "controlPortNumber": 1, + "controlPortDevKey": "dmRmc4kScalerC-1", + "method": "Com" + } + } + }, + { + "key": "comm-3", + "uid": 11, + "name": "Rmc comm 2", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "comParams": { + "hardwareHandshake": "None", + "parity": "None", + "protocol": "RS232", + "baudRate": 9600, + "dataBits": 8, + "softwareHandshake": "None", + "stopBits": 1 + }, + "controlPortNumber": 1, + "controlPortDevKey": "dmRmc200C-1", + "method": "Com" + } + } + }, + { + "key": "cec-1", + "uid": 13, + "name": "Tx 5 cec 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "controlPortName": "HdmiIn", + "controlPortDevKey": "dmTx201C-1", + "method": "Cec" + } + } + }, + { + "key": "cec-5", + "uid": 17, + "name": "Rmc 1 cec 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "controlPortName": "HdmiOut", + "controlPortDevKey": "dmRmc4kScalerC-1", + "method": "Cec" + } + } + }, + { + "key": "cec-6", + "uid": 18, + "name": "Dm Chassis In 1 cec 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "controlPortName": "inputCard1--hdmiIn", + "controlPortDevKey": "dmMd8x8-1", + "method": "Cec" + } + } + }, + { + "key": "cec-7", + "uid": 19, + "name": "Dm Chassis Out 1 cec 1", + "type": "genericComm", + "group": "comm", + "properties": { + "control": { + "controlPortName": "outputCard1--hdmiOut1", + "controlPortDevKey": "dmMd8x8-1", + "method": "Cec" + } + } + }, + { + "key": "gls-oir-1", + "uid": 19, + "name": "GLS-OIR-CN 1", + "type": "glsoirccn", + "group": "occupancy", + "properties": { + "control": { + "cresnetId": "41", + "method": "cresnet" + } + } + }, + { + "key": "gls-odt-1", + "uid": 19, + "name": "GLS-ODT-CN 1", + "type": "glsodtccn", + "group": "occupancy", + "properties": { + "control": { + "cresnetId": "42", + "method": "cresnet" + } + } + } + ], + "rooms": [], + "sourceLists": {}, + "tieLines": [] + }, + "template_url": "", + "system": { + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Example Configuration/SIMPLBridging/configurationFile-dmps3300c-avRouting.json b/PepperDashEssentials/Example Configuration/SIMPLBridging/configurationFile-dmps3300c-avRouting.json new file mode 100644 index 00000000..de6d6fa4 --- /dev/null +++ b/PepperDashEssentials/Example Configuration/SIMPLBridging/configurationFile-dmps3300c-avRouting.json @@ -0,0 +1,70 @@ +{ + "system_url": "", + "template": { + "info": { + "comment": "", + "requiredControlSofwareVersion": "", + "systemType": "huddle", + "lastModifiedDate": "2018-07-09T20:00:47.873Z", + "lastUid": 23, + "processorType": "dmps3300c" + }, + "devices": [ + { + "key": "processor", + "group": "processor", + "uid": 0, + "supportsCompliance": true, + "type": "dmps3300c", + "properties": { + }, + "name": "DMPS3-300-C" + }, + { + "key": "eisc-A", + "uid":4, + "type": "eiscApi", + "group":"api", + "properties": { + "control":{ + "tcpSshProperties":{ + "address":"127.0.0.2", + "port":0 + }, + "ipId":"1A" + }, + "devices": [ + { + "deviceKey":"processor-avRouting", + "joinStart":1 + }, + { + "deviceKey":"processor-programAudioOutput", + "joinStart":3001 + }, + { + "deviceKey":"processor-aux1AudioOutput", + "joinStart":3011 + }, + { + "deviceKey":"processor-aux2AudioOutput", + "joinStart":3021 + } + ] + } + } + ], + "rooms": [ + + ], + "sourceLists": { + + }, + "tieLines": [ + ] + }, + "template_url": "", + "system": { + + } +} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/DevicePageControllerBase.cs b/PepperDashEssentials/FOR REFERENCE UI/PageControllers/DevicePageControllerBase.cs deleted file mode 100644 index 700a32d5..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/DevicePageControllerBase.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; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Presets; - -//namespace PepperDash.Essentials -//{ -// /// -// /// -// /// -// public abstract class DevicePageControllerBase -// { - -// protected BasicTriListWithSmartObject TriList; -// protected List FixedObjectSigs; - -// public DevicePageControllerBase(BasicTriListWithSmartObject triList) -// { -// TriList = triList; -// } - -// public void SetVisible(bool state) -// { -// foreach (var sig in FixedObjectSigs) -// { -// Debug.Console(2, "set visible {0}={1}", sig.Number, state); -// sig.BoolValue = state; -// } -// CustomSetVisible(state); -// } - -// /// -// /// Add any specialized show/hide logic here - beyond FixedObjectSigs. Overriding -// /// methods do not need to call this base method -// /// -// protected virtual void CustomSetVisible(bool state) -// { -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/LargeTouchpanelControllerBase.cs b/PepperDashEssentials/FOR REFERENCE UI/PageControllers/LargeTouchpanelControllerBase.cs deleted file mode 100644 index 6f0345f5..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/LargeTouchpanelControllerBase.cs +++ /dev/null @@ -1,308 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using Crestron.SimplSharpPro.UI; - -//using PepperDash.Core; - - -//namespace PepperDash.Essentials.Core -//{ -// /// -// /// -// /// -// public class LargeTouchpanelControllerBase : SmartGraphicsTouchpanelControllerBase -// { -// public string PresentationShareButtonInVideoText = "Share"; -// public string PresentationShareButtonNotInVideoText = "Presentation"; - -// SourceListSubpageReferenceList SourceSelectSRL; -// DevicePageControllerBase CurrentPresentationSourcePageController; - -// public LargeTouchpanelControllerBase(string key, string name, -// BasicTriListWithSmartObject triList, string sgdFilePath) -// : base(key, name, triList, sgdFilePath) -// { -// } - -// /// -// /// Static factory method -// /// -// public static LargeTouchpanelControllerBase GetController(string key, string name, -// string type, CrestronTswPropertiesConfig props) -// { -// var id = Convert.ToUInt32(props.IpId, 16); -// type = type.ToLower(); -// Tswx52ButtonVoiceControl tsw = null; -// if (type == "tsw752") -// tsw = new Tsw752(id, Global.ControlSystem); -// else if (type == "tsw1052") -// tsw = new Tsw1052(id, Global.ControlSystem); -// else -// { -// Debug.Console(0, "WARNING: Cannot create TSW controller with type '{0}'", type); -// return null; -// } - -// var sgdPath = string.Format(@"\NVRAM\Program{0}\SGD\{1}", -// InitialParametersClass.ApplicationNumber, props.SgdFile); -// var controller = new LargeTouchpanelControllerBase(key, name, tsw, sgdPath); -// controller.UsesSplashPage = props.UsesSplashPage; - -// // Get the room and add it after everthing is ready -// var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey) as EssentialsRoom; -// controller.AddPostActivationAction(() => -// { -// controller.SetCurrentRoom(room); - -// }); - -// return controller; -// } - -// public override bool CustomActivate() -// { -// var baseSuccess = base.CustomActivate(); -// if (!baseSuccess) return false; - -// SourceSelectSRL = new SourceListSubpageReferenceList(this.TriList, n => -// { if (CurrentRoom != null) CurrentRoom.SelectSource(n); }); - -// var lm = Global.LicenseManager; -// if (lm != null) -// { -// lm.LicenseIsValid.LinkInputSig(TriList.BooleanInput[UiCue.ShowLicensed.Number]); -// //others -// } - -// // Wire up buttons -// TriList.SetSigFalseAction(15003, () => SetMainMode(eMainModeType.Presentation)); -// TriList.SetSigFalseAction(15008, PowerOffWithConfirmPressed); -// TriList.SetSigFalseAction(15101, () => SetMainMode(eMainModeType.Presentation)); -// TriList.SetSigFalseAction(15013, ShowHelp); -// TriList.SetSigFalseAction(15014, () => SetMainMode(eMainModeType.Tech)); - -// // Temp things ----------------------------------------------------------------------- -// TriList.StringInput[UiCue.SplashMessage.Number].StringValue = SplashMessage; -// //------------------------------------------------------------------------------------ - -// // Initialize initial view -// ShowSplashOrMain(); -// return true; -// } - -// /// -// /// In Essentials, this should NEVER be called, since it's a one-room solution -// /// -// protected override void HideRoomUI() -// { -// // UI Cleanup here???? - -// //SwapAudioDeviceControls(CurrentRoom.CurrentAudioDevice, null); -// //CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange; - -// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange; - -// SourceSelectSRL.DetachFromCurrentRoom(); -// } - -// /// -// /// Ties this panel controller to the Room and gets updates. -// /// -// protected override void ShowRoomUI() -// { -// Debug.Console(1, this, "connecting to system '{0}'", CurrentRoom.Key); - -// TriList.StringInput[RoomCue.Name.Number].StringValue = CurrentRoom.Name; -// TriList.StringInput[RoomCue.Description.Number].StringValue = CurrentRoom.Description; - -// CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange; -// CurrentRoom.IsCoolingDownFeedback.OutputChange += CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingUp_OutputChange; - -// SourceSelectSRL.AttachToRoom(CurrentRoom); -// } - -// void CurrentRoom_IsCoolingDown_OutputChange(object sender, EventArgs e) -// { -// Debug.Console(2, this, "Received room in cooldown={0}", CurrentRoom.IsCoolingDownFeedback.BoolValue); -// if (CurrentRoom.IsCoolingDownFeedback.BoolValue) // When entering cooldown -// { -// // Do we need to check for an already-running cooldown - like in the case of room switches? -// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power Off", "Power", "Please wait, shutting down", -// "", "", CurrentRoom.CooldownTime, true, b => -// { -// ShowSplashOrMain(); -// }); -// } -// } - -// void CurrentRoom_IsWarmingUp_OutputChange(object sender, EventArgs e) -// { -// Debug.Console(2, this, "Received room in warmup={0}", CurrentRoom.IsWarmingUpFeedback.BoolValue); -// if (CurrentRoom.IsWarmingUpFeedback.BoolValue) // When entering warmup -// { -// // Do we need to check for an already-running cooldown - like in the case of room switches? -// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power On", "Power", "Please wait, powering on", -// "", "", CurrentRoom.WarmupTime, false, b => -// { -// // Reveal sources - or has already been done behind modal -// }); -// } -// } - -// // Handler for source change events. -// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args) -// { -// // Put away the old source and set up the new source. -// Debug.Console(2, this, "Received source change={0}", args.NewSource != null ? args.NewSource.SourceKey : "none"); - -// // If we're in tech, don't switch screen modes. Add any other modes we may want to switch away from -// // inside the if below. -// if (MainMode == eMainModeType.Splash) -// SetMainMode(eMainModeType.Presentation); -// SetControlSource(args.NewSource); -// } - -// //*********************************************************************** -// //** UI Manipulation -// //*********************************************************************** - -// /// -// /// Shows the splash page or the main presentation page, depending on config setting -// /// -// void ShowSplashOrMain() -// { -// if (UsesSplashPage) -// SetMainMode(eMainModeType.Splash); -// else -// SetMainMode(eMainModeType.Presentation); -// } - -// /// -// /// Switches between main modes -// /// -// void SetMainMode(eMainModeType mode) -// { -// MainMode = mode; -// switch (mode) -// { -// case eMainModeType.Presentation: -// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = true; -// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = true; -// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = true; -// ShowCurrentPresentationSourceUi(); -// break; -// case eMainModeType.Splash: -// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = true; -// HideCurrentPresentationSourceUi(); -// break; -// case eMainModeType.Tech: -// new ModalDialog(TriList).PresentModalTimerDialog(1, "Tech page", "Info", -// "Tech page will be here soon!
I promise", -// "Bueno!", "", 0, false, null); -// MainMode = eMainModeType.Presentation; -// break; -// default: -// break; -// } -// } - -// /// -// /// -// /// -// void PowerOffWithConfirmPressed() -// { -// if (CurrentRoom == null) -// return; -// if (!CurrentRoom.RoomIsOnFeedback.BoolValue) -// return; -// // Timeout or button 1 press will shut down -// var modal = new ModalDialog(TriList); -// uint seconds = CurrentRoom.UnattendedShutdownTimeMs / 1000; -// var message = string.Format("Meeting will end in {0} seconds", seconds); -// modal.PresentModalTimerDialog(2, "End Meeting", "Info", message, -// "End Meeting Now", "Cancel", CurrentRoom.UnattendedShutdownTimeMs, true, -// but => { if (but != 2) CurrentRoom.RoomOff(); }); -// } - -// /// -// /// Reveals the basic UI for the current device -// /// -// protected override void ShowCurrentPresentationSourceUi() -// { -// if (MainMode == eMainModeType.Splash && CurrentRoom.RoomIsOnFeedback.BoolValue) -// SetMainMode(eMainModeType.Presentation); - -// if (CurrentPresentationControlDevice == null) -// { -// // If system is off, do one thing - -// // Otherwise, do something else - shouldn't be in this condition - -// return; -// } - -// // If a controller is already loaded, use it -// if (LoadedPageControllers.ContainsKey(CurrentPresentationControlDevice)) -// CurrentPresentationSourcePageController = LoadedPageControllers[CurrentPresentationControlDevice]; -// else -// { -// // This is by no means optimal, but for now.... -// if (CurrentPresentationControlDevice.Type == PresentationSourceType.SetTopBox -// && CurrentPresentationControlDevice is ISetTopBoxControls) -// CurrentPresentationSourcePageController = new PageControllerLargeSetTopBoxGeneric(TriList, -// CurrentPresentationControlDevice as ISetTopBoxControls); - -// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Laptop) -// CurrentPresentationSourcePageController = new PageControllerLaptop(TriList); - -// // separate these... -// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Dvd) -// CurrentPresentationSourcePageController = -// new PageControllerLargeDvd(TriList, CurrentPresentationControlDevice as IDiscPlayerControls); - -// else -// CurrentPresentationSourcePageController = null; - -// // Save it. -// if (CurrentPresentationSourcePageController != null) -// LoadedPageControllers[CurrentPresentationControlDevice] = CurrentPresentationSourcePageController; -// } - -// if (CurrentPresentationSourcePageController != null) -// CurrentPresentationSourcePageController.SetVisible(true); -// } - -// protected override void HideCurrentPresentationSourceUi() -// { -// if (CurrentPresentationControlDevice != null && CurrentPresentationSourcePageController != null) -// CurrentPresentationSourcePageController.SetVisible(false); -// } - - - -// void ShowHelp() -// { -// new ModalDialog(TriList).PresentModalTimerDialog(1, "Help", "Help", CurrentRoom.HelpMessage, -// "OK", "", 0, false, null); -// } - -// protected void ListSmartObjects() -// { -// Debug.Console(0, this, "Smart objects IDs:"); -// var list = TriList.SmartObjects.OrderBy(s => s.Key); -// foreach (var kvp in list) -// Debug.Console(0, " {0}", kvp.Key); -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLaptop.cs b/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLaptop.cs deleted file mode 100644 index dace5dfb..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLaptop.cs +++ /dev/null @@ -1,28 +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; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Presets; - - -//namespace PepperDash.Essentials -//{ -// public class PageControllerLaptop : DevicePageControllerBase -// { -// public PageControllerLaptop(BasicTriListWithSmartObject tl) -// : base(tl) -// { -// FixedObjectSigs = new List -// { -// tl.BooleanInput[10092], // well -// tl.BooleanInput[11001] // Laptop info -// }; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeDvd.cs b/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeDvd.cs deleted file mode 100644 index 46db1f39..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeDvd.cs +++ /dev/null @@ -1,46 +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; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Presets; - -//namespace PepperDash.Essentials -//{ -// /// -// /// -// /// -// public class PageControllerLargeDvd : DevicePageControllerBase -// { -// IDiscPlayerControls Device; - -// public PageControllerLargeDvd(BasicTriListWithSmartObject tl, IDiscPlayerControls device) -// : base(tl) -// { - -// Device = device; -// FixedObjectSigs = new List -// { -// tl.BooleanInput[10093], // well -// tl.BooleanInput[10411], // DVD Dpad -// tl.BooleanInput[10412] // everything else -// }; -// } - -// protected override void CustomSetVisible(bool state) -// { -// // Hook up smart objects if applicable -// if (Device != null) -// { -//#warning rewire this -// //var uos = (Device as IHasCueActionList).CueActionList; -// //SmartObjectHelper.LinkDpadWithUserObjects(TriList, 10411, uos, state); -// } -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeSetTopBoxGeneric.cs b/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeSetTopBoxGeneric.cs deleted file mode 100644 index eb869108..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/PageControllers/PageControllerLargeSetTopBoxGeneric.cs +++ /dev/null @@ -1,139 +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.Essentials.Core.Presets; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; - -//namespace PepperDash.Essentials -//{ - -// public class PageControllerLargeSetTopBoxGeneric : DevicePageControllerBase -// { -// // To-DO: Add properties for component subpage names. DpadPos1, DpadPos2... -// // Derived classes can then insert special subpages for variations on given -// // device types. Like DirecTV vs Comcast - -// public uint DpadSmartObjectId { get; set; } -// public uint NumberPadSmartObjectId { get; set; } -// public uint PresetsSmartObjectId { get; set; } -// public uint Position5TabsId { get; set; } - -// ISetTopBoxControls Device; -// DevicePresetsView PresetsView; - - -// bool ShowPosition5Tabs; -// uint CurrentVisiblePosition5Item = 1; -// Dictionary Position5SubpageJoins = new Dictionary -// { -// { 1, 10053 }, -// { 2, 10054 } -// }; - -// public PageControllerLargeSetTopBoxGeneric(BasicTriListWithSmartObject tl, ISetTopBoxControls device) -// : base(tl) -// { -// Device = device; -// DpadSmartObjectId = 10011; -// NumberPadSmartObjectId = 10014; -// PresetsSmartObjectId = 10012; -// Position5TabsId = 10081; - -// bool dpad = device is IDPad; -// bool preset = device.HasPresets; -// bool dvr = device.HasDvr; -// bool numbers = device is INumericKeypad; -// uint[] joins = null; - -// if (dpad && !preset && !dvr && !numbers) joins = new uint[] { 10031, 10091 }; -// else if (!dpad && preset && !dvr && !numbers) joins = new uint[] { 10032, 10091 }; -// else if (!dpad && !preset && dvr && !numbers) joins = new uint[] { 10033, 10091 }; -// else if (!dpad && !preset && !dvr && numbers) joins = new uint[] { 10034, 10091 }; - -// else if (dpad && preset && !dvr && !numbers) joins = new uint[] { 10042, 10021, 10092 }; -// else if (dpad && !preset && dvr && !numbers) joins = new uint[] { 10043, 10021, 10092 }; -// else if (dpad && !preset && !dvr && numbers) joins = new uint[] { 10044, 10021, 10092 }; -// else if (!dpad && preset && dvr && !numbers) joins = new uint[] { 10043, 10022, 10092 }; -// else if (!dpad && preset && !dvr && numbers) joins = new uint[] { 10044, 10022, 10092 }; -// else if (!dpad && !preset && dvr && numbers) joins = new uint[] { 10044, 10023, 10092 }; - -// else if (dpad && preset && dvr && !numbers) joins = new uint[] { 10053, 10032, 10011, 10093 }; -// else if (dpad && preset && !dvr && numbers) joins = new uint[] { 10054, 10032, 10011, 10093 }; -// else if (dpad && !preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10011, 10093 }; -// else if (!dpad && preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10012, 10093 }; - -// else if (dpad && preset && dvr && numbers) -// { -// joins = new uint[] { 10081, 10032, 10011, 10093 }; // special case -// ShowPosition5Tabs = true; -// } -// // Project the joins into corresponding sigs. -// FixedObjectSigs = joins.Select(u => TriList.BooleanInput[u]).ToList(); - -// // Build presets -// if (device.HasPresets) -// { -// PresetsView = new DevicePresetsView(tl, device.PresetsModel); -// } -// } - -// protected override void CustomSetVisible(bool state) -// { -// if (ShowPosition5Tabs) -// { -// // Show selected tab -// TriList.BooleanInput[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = state; - -// var tabSo = TriList.SmartObjects[Position5TabsId]; -// if (state) // Link up the tab object -// { -// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = new Action(b => ShowTab(1)); -// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = new Action(b => ShowTab(2)); -// } -// else // Disco tab object -// { -// tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = null; -// tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = null; -// } -// } - -// // Hook up smart objects if applicable -//#warning hook these up -// //if (Device is IHasCueActionList) -// //{ -// // var uos = (Device as IHasCueActionList).CueActionList; -// // SmartObjectHelper.LinkDpadWithUserObjects(TriList, DpadSmartObjectId, uos, state); -// // SmartObjectHelper.LinkNumpadWithUserObjects(TriList, NumberPadSmartObjectId, -// // uos, CommonBoolCue.Dash, CommonBoolCue.Last, state); -// //} - - -// // Link, unlink presets -// if (Device.HasPresets && state) -// PresetsView.Attach(); -// else if (Device.HasPresets && !state) -// PresetsView.Detach(); -// } - -// void ShowTab(uint number) -// { -// // Ignore re-presses -// if (CurrentVisiblePosition5Item == number) return; -// // Swap subpage -// var bi = TriList.BooleanInput; -// if (CurrentVisiblePosition5Item > 0) -// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = false; -// CurrentVisiblePosition5Item = number; -// bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = true; - -// // Show feedback on buttons -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/Panels/REMOVE UiCue.cs b/PepperDashEssentials/FOR REFERENCE UI/Panels/REMOVE UiCue.cs deleted file mode 100644 index 1bfaa2bb..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/Panels/REMOVE UiCue.cs +++ /dev/null @@ -1,43 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; - -//namespace PepperDash.Essentials.Core -//{ -// public class UiCue -// { -// public static readonly Cue VisibleSystemInit = Cue.BoolCue("VisibleSystemInit", 15001); -// public static readonly Cue VisibleSplash = Cue.BoolCue("VisibleSplash", 15002); -// public static readonly Cue PressSplash = Cue.BoolCue("PressSplash", 15003); -// public static readonly Cue PressRoomOn = Cue.BoolCue("PressRoomOn", 15006); -// public static readonly Cue PressRoomOff = Cue.BoolCue("PressRoomOff", 15007); -// public static readonly Cue PressRoomOffWithConfirm = Cue.BoolCue("PressRoomOffWithConfirm", 15008); -// public static readonly Cue VisibleCommonHeader = Cue.BoolCue("PressPowerOffConfirm", 15011); -// public static readonly Cue VisibleCommonFooter = Cue.BoolCue("VisibleCommonFooter", 15012); -// public static readonly Cue PressHelp = Cue.BoolCue("PressHelp", 15013); -// public static readonly Cue PressSettings = Cue.BoolCue("PressSettings", 15014); - -// public static readonly Cue ShowDate = Cue.BoolCue("PressSettings", 15015); -// public static readonly Cue ShowTime = Cue.BoolCue("PressSettings", 15016); -// public static readonly Cue ShowLicensed = Cue.BoolCue("PressSettings", 15017); -// public static readonly Cue ShowUnLicensed = Cue.BoolCue("PressSettings", 15018); - -// public static readonly Cue PressModePresentationShare = Cue.BoolCue("PressModePresentationShare", 15101); -// public static readonly Cue PressModeVideoConf = Cue.BoolCue("PressModeVideoConf", 15102); -// public static readonly Cue PressModeAudioConf = Cue.BoolCue("PressModeAudioConf", 15103); - -// public static readonly Cue VisiblePresentationSourceList = Cue.BoolCue("VisiblePresentationSourceList", 15111); -// public static readonly Cue VisibleSystemIsOff = Cue.BoolCue("VisibleSystemIsOff", 15112); - -// public static readonly Cue VisibleAudioConfPopover = Cue.BoolCue("VisibleAudioConfPopover", 15201); - -// public static readonly Cue VisibleVideoConfPopover = Cue.BoolCue("VisibleVideoConfPopover", 15251); - -// public static readonly Cue TextRoomName = Cue.BoolCue("TextRoomName", 4001); -// public static readonly Cue TextPresentationShareButton = Cue.BoolCue("TextPresentationShareButton", 4011); - -// public static readonly Cue SplashMessage = Cue.StringCue("SplashMessage", 2101); -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/Panels/SmartGraphicsTouchpanelControllerBase.cs b/PepperDashEssentials/FOR REFERENCE UI/Panels/SmartGraphicsTouchpanelControllerBase.cs deleted file mode 100644 index 8e8b9192..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/Panels/SmartGraphicsTouchpanelControllerBase.cs +++ /dev/null @@ -1,318 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; - - -//namespace PepperDash.Essentials.Core -//{ -// public abstract class SmartGraphicsTouchpanelControllerBase : CrestronGenericBaseDevice -// { -// public BasicTriListWithSmartObject TriList { get; protected set; } -// public bool UsesSplashPage { get; set; } -// public string SplashMessage { get; set; } -// public bool ShowDate -// { -// set { TriList.BooleanInput[UiCue.ShowDate.Number].BoolValue = value; } -// } -// public bool ShowTime -// { -// set { TriList.BooleanInput[UiCue.ShowTime.Number].BoolValue = value; } -// } - -// //public abstract List FunctionList { get; } - - -// protected eMainModeType MainMode; -// protected SourceListItem CurrentPresentationControlDevice; - -// /// -// /// Defines the signal offset for the presentation device. Defaults to 100 -// /// -// public uint PresentationControlDeviceJoinOffset { get { return 100; } } - -// public enum eMainModeType -// { -// Presentation, Splash, Tech -// } - -// protected string SgdFilePath; -// public EssentialsRoom CurrentRoom { get; protected set; } -// protected Dictionary LoadedPageControllers -// = new Dictionary(); - -// static object RoomChangeLock = new object(); - -// /// -// /// Constructor -// /// -// public SmartGraphicsTouchpanelControllerBase(string key, string name, BasicTriListWithSmartObject triList, -// string sgdFilePath) -// : base(key, name, triList) -// { -// TriList = triList; -// if (string.IsNullOrEmpty(key)) throw new ArgumentNullException("key"); -// if (string.IsNullOrEmpty(sgdFilePath)) throw new ArgumentNullException("sgdFilePath"); -// SgdFilePath = sgdFilePath; -// TriList.LoadSmartObjects(SgdFilePath); -// UsesSplashPage = true; -// SplashMessage = "Welcome"; -// TriList.SigChange += Tsw_AnySigChange; -// foreach (var kvp in TriList.SmartObjects) -// kvp.Value.SigChange += this.Tsw_AnySigChange; -// } - -//#warning wire UI manipulating presses up here, typically in child classes... -// //public override bool CustomActivate() -// //{ -// // var baseSuccess = base.CustomActivate(); -// // if (!baseSuccess) return false; - - -// // // Wiring up the buttons with UOs -// // foreach (var uo in this.FunctionList) -// // { -// // if (uo.Cue.Number == 0) continue; -// // //if (uo is BoolCueActionPair) -// // // TriList.BooleanOutput[uo.Cue.Number].UserObject = uo; -// // //else if (uo is UShortCueActionPair) -// // // TriList.UShortOutput[uo.Cue.Number].UserObject = uo; -// // //else if (uo is StringCueActionPair) -// // // TriList.StringOutput[uo.Cue.Number].UserObject = uo; -// // } - -// // return true; -// //} - -// //public void SetCurrentRoom(EssentialsRoom room) -// //{ -// // if (CurrentRoom != null) -// // HideRoomUI(); -// // CurrentRoom = room; -// // ShowRoomUI(); -// //} - -// /// -// /// -// /// -// /// -// public void SetCurrentRoom(EssentialsRoom room) -// { -// if (CurrentRoom == room) return; - -// IBasicVolumeControls oldAudio = null; -// //Disconnect current room and audio device -// if (CurrentRoom != null) -// { -// HideRoomUI(); -// CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange; -// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange; -// oldAudio = CurrentRoom.CurrentAudioDevice; -// } - -// CurrentRoom = room; -// IBasicVolumeControls newAudio = null; -// if (CurrentRoom != null) -// { -// CurrentRoom.AudioDeviceWillChange += this.CurrentRoom_AudioDeviceWillChange; -// CurrentRoom.PresentationSourceChange += this.CurrentRoom_PresentationSourceChange; -// SetControlSource(CurrentRoom.CurrentPresentationSourceInfo); -// newAudio = CurrentRoom.CurrentAudioDevice; -// ShowRoomUI(); -// } - -// SwapAudioDeviceControls(oldAudio, newAudio); -// } - -// /// -// /// Detaches and attaches an IVolumeFunctions device to the appropriate TP TriList signals. -// /// This will also add IVolumeNumeric if the device implements it. -// /// Overriding classes should call this. Overriding classes are responsible for -// /// linking up to hard keys, etc. -// /// -// /// May be null -// /// May be null -// protected virtual void SwapAudioDeviceControls(IBasicVolumeControls oldDev, IBasicVolumeControls newDev) -// { -// // Disconnect -// if (oldDev != null) -// { -// TriList.BooleanOutput[CommonBoolCue.VolumeDown.Number].UserObject = null; -// TriList.BooleanOutput[CommonBoolCue.VolumeUp.Number].UserObject = null; -// TriList.BooleanOutput[CommonBoolCue.MuteToggle.Number].UserObject = null; -// TriList.BooleanInput[CommonBoolCue.ShowVolumeButtons.Number].BoolValue = false; -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = false; -// if (oldDev is IBasicVolumeWithFeedback) -// { -// var fbDev = oldDev as IBasicVolumeWithFeedback; -// TriList.UShortOutput[401].UserObject = null; -// fbDev.MuteFeedback.UnlinkInputSig(TriList.BooleanInput[403]); -// fbDev.VolumeLevelFeedback.UnlinkInputSig(TriList.UShortInput[401]); -// } -// } -// if (newDev != null) -// { -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true; -// TriList.SetBoolSigAction(401, newDev.VolumeUp); -// TriList.SetBoolSigAction(402, newDev.VolumeDown); -// TriList.SetSigFalseAction(405, newDev.MuteToggle); - -// if (newDev is IBasicVolumeWithFeedback) // Show slider -// { -// var fbDev = newDev as IBasicVolumeWithFeedback; -// TriList.BooleanInput[406].BoolValue = false; -// TriList.BooleanInput[407].BoolValue = true; -// TriList.UShortOutput[401].UserObject = new Action(fbDev.SetVolume); -// fbDev.VolumeLevelFeedback.LinkInputSig(TriList.UShortInput[401]); -// } -// else // Show buttons only -// { -// TriList.BooleanInput[406].BoolValue = true; -// TriList.BooleanInput[407].BoolValue = false; -// } - -// } -// } - - -// /// -// /// Does nothing. Override to add functionality when calling SetCurrentRoom -// /// -// protected virtual void HideRoomUI() { } - -// /// -// /// Does nothing. Override to add functionality when calling SetCurrentRoom -// /// -// protected virtual void ShowRoomUI() { } - -// /// -// /// Sets up the current presentation device and updates statuses if the device is capable. -// /// -// protected void SetControlSource(SourceListItem newSource) -// { -// if (CurrentPresentationControlDevice != null) -// { -// HideCurrentPresentationSourceUi(); -//#warning Get button methods from RESI, and find a more-well-defined way to wire up feedbacks - -// // Unhook presses and things -// //if (CurrentPresentationControlDevice is IHasCueActionList) -// //{ -// // foreach (var uo in (CurrentPresentationControlDevice as IHasCueActionList).CueActionList) -// // { -// // if (uo.Cue.Number == 0) continue; -// // if (uo is BoolCueActionPair) -// // { -// // var bSig = TriList.BooleanOutput[uo.Cue.Number]; -// // // Disconnection should also clear bool sigs in case they are pressed and -// // // might be orphaned -// // if (bSig.BoolValue) -// // (bSig.UserObject as BoolCueActionPair).Invoke(false); -// // bSig.UserObject = null; -// // } -// // else if (uo is UShortCueActionPair) -// // TriList.UShortOutput[uo.Cue.Number].UserObject = null; -// // else if (uo is StringCueActionPair) -// // TriList.StringOutput[uo.Cue.Number].UserObject = null; -// // } -// //} -// // unhook outputs -// if (CurrentPresentationControlDevice is IHasFeedback) -// { -// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks) -// { -// if (fb.Cue.Number == 0) continue; -// if (fb is BoolFeedback) -// (fb as BoolFeedback).UnlinkInputSig(TriList.BooleanInput[fb.Cue.Number]); -// else if (fb is IntFeedback) -// (fb as IntFeedback).UnlinkInputSig(TriList.UShortInput[fb.Cue.Number]); -// else if (fb is StringFeedback) -// (fb as StringFeedback).UnlinkInputSig(TriList.StringInput[fb.Cue.Number]); -// } -// } -// } -// CurrentPresentationControlDevice = newSource; -// //connect presses and things -// //if (newSource is IHasCueActionList) // This has functions, get 'em -// //{ -// // foreach (var ao in (newSource as IHasCueActionList).CueActionList) -// // { -// // if (ao.Cue.Number == 0) continue; -// // if (ao is BoolCueActionPair) -// // TriList.BooleanOutput[ao.Cue.Number].UserObject = ao; -// // else if (ao is UShortCueActionPair) -// // TriList.UShortOutput[ao.Cue.Number].UserObject = ao; -// // else if (ao is StringCueActionPair) -// // TriList.StringOutput[ao.Cue.Number].UserObject = ao; -// // } -// //} -// // connect outputs (addInputSig should update sig) -// if (CurrentPresentationControlDevice is IHasFeedback) -// { -// foreach (var fb in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks) -// { -// if (fb.Cue.Number == 0) continue; -// if (fb is BoolFeedback) -// (fb as BoolFeedback).LinkInputSig(TriList.BooleanInput[fb.Cue.Number]); -// else if (fb is IntFeedback) -// (fb as IntFeedback).LinkInputSig(TriList.UShortInput[fb.Cue.Number]); -// else if (fb is StringFeedback) -// (fb as StringFeedback).LinkInputSig(TriList.StringInput[fb.Cue.Number]); -// } -// } -// ShowCurrentPresentationSourceUi(); -// } - -// /// -// /// Reveals the basic UI for the current device -// /// -// protected virtual void ShowCurrentPresentationSourceUi() -// { -// } - -// /// -// /// Hides the UI for the current device and calls for a feedback signal cleanup -// /// -// protected virtual void HideCurrentPresentationSourceUi() -// { -// } - - -// /// -// /// -// /// -// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args) -// { -// SetControlSource(args.NewSource); -// } - - -// /// -// /// -// /// -// void CurrentRoom_AudioDeviceWillChange(object sender, EssentialsRoomAudioDeviceChangeEventArgs e) -// { -// SwapAudioDeviceControls(e.OldDevice, e.NewDevice); -// } - - - -// /// -// /// Panel event handler -// /// -// void Tsw_AnySigChange(object currentDevice, SigEventArgs args) -// { -// // plugged in commands -// object uo = args.Sig.UserObject; - -// if (uo is Action) -// (uo as Action)(args.Sig.BoolValue); -// else if (uo is Action) -// (uo as Action)(args.Sig.UShortValue); -// else if (uo is Action) -// (uo as Action)(args.Sig.StringValue); -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/FOR REFERENCE UI/SRL/SourceListSubpageReferenceList.cs b/PepperDashEssentials/FOR REFERENCE UI/SRL/SourceListSubpageReferenceList.cs deleted file mode 100644 index 6eee8bd6..00000000 --- a/PepperDashEssentials/FOR REFERENCE UI/SRL/SourceListSubpageReferenceList.cs +++ /dev/null @@ -1,164 +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 Crestron.SimplSharpPro.UI; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; - -//namespace PepperDash.Essentials -//{ - -// //***************************************************************************** -// /// -// /// Wrapper class for subpage reference list. Contains helpful methods to get at the various signal groupings -// /// and to get individual signals using an index and a join. -// /// -// public class SourceListSubpageReferenceList : SubpageReferenceList -// { -// public const uint SmartObjectJoin = 3801; - -// Action SourceSelectCallback; - -// EssentialsRoom CurrentRoom; - -// public SourceListSubpageReferenceList(BasicTriListWithSmartObject tl, -// Action sourceSelectCallback) -// : base(tl, SmartObjectJoin, 3, 1, 3) -// { -// SourceSelectCallback = sourceSelectCallback; -// } - -// void SetSourceList(Dictionary dict) -// { -// // Iterate all positions, including ones missing from the dict. -// var max = dict.Keys.Max(); -// for (uint i = 1; i <= max; i++) -// { -// // Add the source if it's in the dict -// if (dict.ContainsKey(i)) -// { -// Items.Add(new SourceListSubpageReferenceListItem(i, dict[i], this, SourceSelectCallback)); -// // Plug the callback function into the buttons -// } -// // Blank the line -// else -// Items.Add(new SourceListSubpageReferenceListItem(i, null, -// this, SourceSelectCallback)); -// } -// Count = (ushort)max; -// } - -// /// -// /// Links the SRL to the Room's PresentationSourceChange event for updating of the UI -// /// -// /// -// public void AttachToRoom(EssentialsRoom room) -// { -// CurrentRoom = room; -// SetSourceList(room.Sources); -// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange; -// CurrentRoom.PresentationSourceChange += CurrentRoom_PresentationSourceChange; -// SetPresentationSourceFb(CurrentRoom.CurrentPresentationSource); -// } - -// /// -// /// Disconnects the SRL from a Room's PresentationSourceChange -// /// -// public void DetachFromCurrentRoom() -// { -// ClearPresentationSourceFb(CurrentRoom.CurrentPresentationSource); -// if(CurrentRoom != null) -// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange; -// CurrentRoom = null; -// } - -// // Handler to route source changes into list feedback -// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args) -// { -// Debug.Console(2, "SRL received source change"); -// ClearPresentationSourceFb(args.OldSource); -// SetPresentationSourceFb(args.NewSource); -// } - -// void ClearPresentationSourceFb(IPresentationSource source) -// { -// if (source == null) return; -// var oldSourceItem = (SourceListSubpageReferenceListItem)Items.FirstOrDefault( -// i => ((SourceListSubpageReferenceListItem)i).SourceDevice == source); -// if (oldSourceItem != null) -// oldSourceItem.ClearFeedback(); -// } - -// void SetPresentationSourceFb(SourceListItem source) -// { -// if (source == null) return; -// // Now set the new source to light up -// var newSourceItem = (SourceListSubpageReferenceListItem)Items.FirstOrDefault( -// i => ((SourceListSubpageReferenceListItem)i).SourceDevice == source); -// if (newSourceItem != null) -// newSourceItem.SetFeedback(); -// } -// } - -// public class SourceListSubpageReferenceListItem : SubpageReferenceListItem -// { -// public readonly IPresentationSource SourceDevice; - -// public const uint ButtonPressJoin = 1; -// public const uint SelectedFeedbackJoin = 2; -// public const uint ButtonTextJoin = 1; -// public const uint IconNameJoin = 2; - -// public SourceListSubpageReferenceListItem(uint index, SourceListItem srcDeviceItem, -// SubpageReferenceList owner, Action sourceSelectCallback) -// : base(index, owner) -// { -// if (srcDeviceItem == null) throw new ArgumentNullException("srcDeviceItem"); -// if (owner == null) throw new ArgumentNullException("owner"); -// if (sourceSelectCallback == null) throw new ArgumentNullException("sourceSelectCallback"); - - -// SourceDevice = srcDeviceItem; -// var nameSig = owner.StringInputSig(index, ButtonTextJoin); -// // Should be able to see if there is not enough buttons right here -// if (nameSig == null) -// { -// Debug.Console(0, "ERROR: Item {0} does not exist on source list SRL", index); -// return; -// } -// nameSig.StringValue = srcDeviceItem.Name; -// owner.StringInputSig(index, IconNameJoin).StringValue = srcDeviceItem.Icon; - -// // Assign a source selection action to the appropriate button's UserObject - on release -// owner.GetBoolFeedbackSig(index, ButtonPressJoin).UserObject = new Action(b => -// { if (!b) sourceSelectCallback(index); }); - -// // hook up the video icon -// var videoDev = srcDeviceItem as IAttachVideoStatus; -// if (videoDev != null) -// { -// var status = videoDev.GetVideoStatuses(); -// if (status != null) -// { -// Debug.Console(1, "Linking {0} video status to SRL", videoDev.Key); -// videoDev.GetVideoStatuses().VideoSyncFeedback.LinkInputSig(owner.BoolInputSig(index, 3)); -// } -// } -// } - -// public void SetFeedback() -// { -// Owner.BoolInputSig(Index, SelectedFeedbackJoin).BoolValue = true; -// } - -// public void ClearFeedback() -// { -// Owner.BoolInputSig(Index, SelectedFeedbackJoin).BoolValue = false; -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 79972021..dcd5b0c9 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -127,9 +127,11 @@ + + @@ -161,30 +163,15 @@ + + - - - - - - - - - - - - - - - - - @@ -214,14 +201,7 @@ - - - - - - - @@ -251,12 +231,22 @@ - - + + Always + + + Always + + + Always + + + Always + Always @@ -278,9 +268,6 @@ Essentials Devices Common - - - diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 83beada4..36e6828b 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -1,8 +1,10 @@ using System.Reflection; +using Crestron.SimplSharp.Reflection; -[assembly: AssemblyTitle("PepperDashEssentials")] -[assembly: AssemblyCompany("PepperDash Technology Corp")] -[assembly: AssemblyProduct("PepperDashEssentials")] -[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.0.*")] - +[assembly: System.Reflection.AssemblyTitle("PepperDashEssentials")] +[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] +[assembly: System.Reflection.AssemblyProduct("PepperDashEssentials")] +[assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash Technology Corp 2020")] +[assembly: System.Reflection.AssemblyVersion("0.0.0.*")] +[assembly: System.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] +[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] diff --git a/PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1 b/PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1 index 46392b31..396b5cf0 100644 --- a/PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1 +++ b/PepperDashEssentials/Properties/UpdateAssemblyVersion.ps1 @@ -1,13 +1,23 @@ function Update-SourceVersion { Param ([string]$Version) - $NewVersion = ‘AssemblyVersion("‘ + $Version + ‘.*")’; + $fullVersion = $Version + $baseVersion = [regex]::Match($Version, "(\d+.\d+.\d+).*").captures.groups[1].value + $NewAssemblyVersion = ‘AssemblyVersion("‘ + $baseVersion + ‘.*")’ + echo "AssemblyVersion = $NewAssemblyVersion" + $NewAssemblyInformationalVersion = ‘AssemblyInformationalVersion("‘ + $Version + ‘")’ + echo "AssemblyInformationalVersion = $NewAssemblyInformationalVersion" + foreach ($o in $input) - { + { Write-output $o.FullName $TmpFile = $o.FullName + “.tmp” get-content $o.FullName | - %{$_ -replace ‘AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\)’, $NewVersion } > $TmpFile + %{ + $_ -replace ‘AssemblyVersion\(".*"\)’, $NewAssemblyVersion} | + %{ + $_ -replace ‘AssemblyInformationalVersion\(".*"\)’, $NewAssemblyInformationalVersion + } > $TmpFile move-item $TmpFile $o.FullName -force } } @@ -21,9 +31,10 @@ function Update-AllAssemblyInfoFiles ( $version ) } # validate arguments -$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "^\d+\.\d+\.\d+$"); +$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "\d+\.\d+\.\d+.*"); if ($r.Success) { + echo "Updating Assembly Version to $args ..."; Update-AllAssemblyInfoFiles $args[0]; } else diff --git a/PepperDashEssentials/REMOVE EssentialsApp.cs b/PepperDashEssentials/REMOVE EssentialsApp.cs deleted file mode 100644 index 3e71d576..00000000 --- a/PepperDashEssentials/REMOVE EssentialsApp.cs +++ /dev/null @@ -1,69 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharp.CrestronIO; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using Crestron.SimplSharpPro.CrestronThread; -//using Crestron.SimplSharpPro.Diagnostics; -//using Crestron.SimplSharpPro.EthernetCommunication; -//using Crestron.SimplSharpPro.UI; - -//using Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; -//using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Core.Devices; -////using PepperDash.Essentials.Core.Devices.Dm; - -//using PepperDash.Essentials.Displays; - -////using PepperDash.Essentials.Core.Http; -//using PepperDash.Core; - - -//namespace PepperDash.Essentials -//{ -// public class EssentialsApp -// { -// public string ConfigPath { get; set; } - -// public Dictionary Rooms { get; private set; } - -// //EssentialsHttpApiHandler ApiHandler; // MOVE ??????????????????? - -// public EssentialsApp(CrestronControlSystem cs) -// { -// // Use a fake license manager for now -// Global.LicenseManager = PepperDash.Essentials.License.MockEssentialsLicenseManager.Manager; - - -// // ---------------------------------- Make this configurable -// //var server = Global.HttpConfigServer; -// //server.Start(8081, "HttpConfigServer"); -// //ConfigPath = string.Format(@"\NVRAM\Program{0}\EssentialsConfiguration.json", -// // InitialParametersClass.ApplicationNumber); -// //ApiHandler = new EssentialsHttpApiHandler(server, ConfigPath, @"\HTML\presets\lists\"); - -// Debug.Console(0, "\r\r--------------------CONFIG BEGIN--------------------\r"); -// Configuration.Initialize(cs); -// Configuration.ReadConfiguration(ConfigPath); -// Debug.Console(0, "\r--------------------CONFIG END----------------------\r\r"); -// } -// } - -// public class ResponseToken -// { -// public string Token { get; private set; } -// public DateTime Expires { get; private set; } -// public bool IsExpired { get { return Expires < DateTime.Now; } } - -// public ResponseToken(int timeoutMinutes) -// { -// Expires = DateTime.Now.AddMinutes(timeoutMinutes); -// Token = Guid.NewGuid().ToString(); -// } -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index 9fd4b863..9bec05b8 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -223,7 +223,9 @@ namespace PepperDash.Essentials CrestronEnvironment.Sleep(1000); - RunRouteAction("roomOff", SourceListKey); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room"); + + RunRouteAction("roomOff"); } /// @@ -237,7 +239,7 @@ namespace PepperDash.Essentials return false; } - RunRouteAction(DefaultSourceItem, SourceListKey); + RunRouteAction(DefaultSourceItem); return true; } @@ -260,9 +262,9 @@ namespace PepperDash.Essentials /// /// /// - public void RunRouteAction(string routeKey, string sourceListKey) + public void RunRouteAction(string routeKey) { - RunRouteAction(routeKey, sourceListKey, null); + RunRouteAction(routeKey, null); } /// @@ -270,16 +272,16 @@ namespace PepperDash.Essentials /// route or commands /// /// - public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) + public void RunRouteAction(string routeKey, Action successCallback) { // Run this on a separate thread new CTimer(o => { - Debug.Console(1, this, "Run route action '{0}'", routeKey); - var dict = ConfigReader.ConfigObject.GetSourceListForKey(sourceListKey); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Run route action '{0}'", routeKey); + var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); if(dict == null) { - Debug.Console(1, this, "WARNING: Config source list '{0}' not found", sourceListKey); + Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); return; } @@ -287,7 +289,7 @@ namespace PepperDash.Essentials if (!dict.ContainsKey(routeKey)) { Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", - routeKey, sourceListKey); + routeKey, SourceListKey); return; } @@ -426,7 +428,7 @@ namespace PepperDash.Essentials { if (!EnablePowerOnToLastSource || LastSourceKey == null) return; - RunRouteAction(LastSourceKey, SourceListKey); + RunRouteAction(LastSourceKey); } /// @@ -494,7 +496,7 @@ namespace PepperDash.Essentials var allRooms = DeviceManager.AllDevices.Where(d => d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); foreach (var room in allRooms) - (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as EssentialsHuddleSpaceRoom).SourceListKey); + (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); } } } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 51d9c364..b2db56ae 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -334,8 +334,11 @@ namespace PepperDash.Essentials { // Add Occupancy object from config if (PropertiesConfig.Occupancy != null) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Setting Occupancy Provider for room"); this.SetRoomOccupancy(DeviceManager.GetDeviceForKey(PropertiesConfig.Occupancy.DeviceKey) as IOccupancyStatusProvider, PropertiesConfig.Occupancy.TimeoutMinutes); + } this.LogoUrl = PropertiesConfig.Logo.GetUrl(); this.SourceListKey = PropertiesConfig.SourceListKey; @@ -359,7 +362,9 @@ namespace PepperDash.Essentials CrestronEnvironment.Sleep(1000); - RunRouteAction("roomOff", SourceListKey); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting down room"); + + RunRouteAction("roomOff"); } /// @@ -368,7 +373,7 @@ namespace PepperDash.Essentials public override bool RunDefaultPresentRoute() { if (DefaultSourceItem != null) - RunRouteAction(DefaultSourceItem, SourceListKey); + RunRouteAction(DefaultSourceItem); return DefaultSourceItem != null; } @@ -379,7 +384,7 @@ namespace PepperDash.Essentials /// public bool RunDefaultCallRoute() { - RunRouteAction(DefaultCodecRouteString, SourceListKey); + RunRouteAction(DefaultCodecRouteString); return true; } @@ -387,9 +392,9 @@ namespace PepperDash.Essentials /// /// /// - public void RunRouteAction(string routeKey, string sourceListKey) + public void RunRouteAction(string routeKey) { - RunRouteAction(routeKey, sourceListKey, null); + RunRouteAction(routeKey, null); } /// @@ -397,7 +402,7 @@ namespace PepperDash.Essentials /// route or commands /// /// - public void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) + public void RunRouteAction(string routeKey, Action successCallback) { // Run this on a separate thread new CTimer(o => @@ -408,11 +413,11 @@ namespace PepperDash.Essentials try { - Debug.Console(1, this, "Run route action '{0}'", routeKey); - var dict = ConfigReader.ConfigObject.GetSourceListForKey(sourceListKey); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Run route action '{0}'", routeKey); + var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); if (dict == null) { - Debug.Console(1, this, "WARNING: Config source list '{0}' not found", sourceListKey); + Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); return; } @@ -619,7 +624,7 @@ namespace PepperDash.Essentials { if (!EnablePowerOnToLastSource || LastSourceKey == null) return; - RunRouteAction(LastSourceKey, SourceListKey); + RunRouteAction(LastSourceKey); } /// @@ -630,7 +635,7 @@ namespace PepperDash.Essentials var allRooms = DeviceManager.AllDevices.Where(d => d is EssentialsHuddleSpaceRoom && !(d as EssentialsHuddleSpaceRoom).ExcludeFromGlobalFunctions); foreach (var room in allRooms) - (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff", (room as EssentialsHuddleSpaceRoom).SourceListKey); + (room as EssentialsHuddleSpaceRoom).RunRouteAction("roomOff"); } #region IPrivacy Members diff --git a/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs b/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs deleted file mode 100644 index 10a87dca..00000000 --- a/PepperDashEssentials/Room/Types/EssentialsPresentationRoom.cs +++ /dev/null @@ -1,437 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.Room.Config; - -//namespace PepperDash.Essentials -//{ -// public class EssentialsPresentationRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange -// { -// public event EventHandler CurrentVolumeDeviceChange; -// public event SourceInfoChangeHandler CurrentSingleSourceChange; -// public event SourceInfoChangeHandler CurrentDisplay1SourceChange; -// public event SourceInfoChangeHandler CurrentDisplay2SourceChange; - -// protected override Func OnFeedbackFunc { get { -// return () => (CurrentSingleSourceInfo != null -// && CurrentSingleSourceInfo.Type != eSourceListItemType.Off) -// || (Display1SourceInfo != null -// && Display1SourceInfo.Type != eSourceListItemType.Off) -// || (Display2SourceInfo != null -// && Display2SourceInfo.Type != eSourceListItemType.Off); } } - -// protected override Func IsWarmingFeedbackFunc { get { return () =>false;; } } -// protected override Func IsCoolingFeedbackFunc { get { return () => false; } } - -// public EssentialsPresentationRoomPropertiesConfig Config { get; private set; } - -// public Dictionary Displays { get; private set; } - -// public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } -// public IBasicVolumeControls DefaultVolumeControls { get; private set; }C:\Working Directories\PD\essentials\PepperDashEssentials\Room\Types\EssentialsPresentationRoom.cs - -// /// -// /// The config name of the source list -// /// -// public string SourceListKey { get; set; } - -// /// -// /// If room is off, enables power on to last source. Default true -// /// -// public bool EnablePowerOnToLastSource { get; set; } -// string LastSourceKey; - -// public enum eVideoRoutingMode -// { -// SelectSourceSelectDisplay, SourceToAllDisplays -// } - -// public eVideoRoutingMode VideoRoutingMode { get; set; } - -// public enum eAudioRoutingMode -// { -// AudioFollowsLastVideo, SelectAudioFromDisplay -// } - -// /// -// /// -// /// -// public IBasicVolumeControls CurrentVolumeControls -// { -// get { return _CurrentAudioDevice; } -// set -// { -// if (value == _CurrentAudioDevice) return; - -// var oldDev = _CurrentAudioDevice; -// // derigister this room from the device, if it can -// if (oldDev is IInUseTracking) -// (oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio"); -// var handler = CurrentVolumeDeviceChange; -// if (handler != null) -// CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange)); -// _CurrentAudioDevice = value; -// if (handler != null) -// CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange)); -// // register this room with new device, if it can -// if (_CurrentAudioDevice is IInUseTracking) -// (_CurrentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio"); -// } -// } -// IBasicVolumeControls _CurrentAudioDevice; - -// /// -// /// The SourceListItem last run - containing names and icons. The complex setter is -// /// to add/remove this room to the source's InUseTracking, if it is capable -// /// -// public SourceListItem CurrentSingleSourceInfo -// { -// get { return _CurrentSingleSourceInfo; } -// private set -// { -// if (value == _CurrentSingleSourceInfo) return; - -// var handler = CurrentSingleSourceChange; -// // remove from in-use tracker, if so equipped -// if(_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking) -// (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.RemoveUser(this, "control"); - -// if (handler != null) -// handler(this, _CurrentSingleSourceInfo, ChangeType.WillChange); - -// _CurrentSingleSourceInfo = value; - -// // add to in-use tracking -// if (_CurrentSingleSourceInfo != null && _CurrentSingleSourceInfo.SourceDevice is IInUseTracking) -// (_CurrentSingleSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); -// if (handler != null) -// handler(this, _CurrentSingleSourceInfo, ChangeType.DidChange); -// } -// } -// SourceListItem _CurrentSingleSourceInfo; - -// public SourceListItem Display1SourceInfo -// { -// get { return _Display1SourceInfo; } -// set -// { -// if (value == _Display1SourceInfo) return; - -// var handler = CurrentDisplay1SourceChange; -// if (handler != null) -// handler(this, _Display1SourceInfo, ChangeType.WillChange); - -// _Display1SourceInfo = value; - -// if (handler != null) -// handler(this, _Display1SourceInfo, ChangeType.DidChange); -// } -// } -// SourceListItem _Display1SourceInfo; - -// public SourceListItem Display2SourceInfo -// { -// get { return _Display2SourceInfo; } -// set -// { -// if (value == _Display2SourceInfo) return; - -// var handler = CurrentDisplay2SourceChange; -// if (handler != null) -// handler(this, _Display2SourceInfo, ChangeType.WillChange); - -// _Display2SourceInfo = value; - -// if (handler != null) -// handler(this, _Display2SourceInfo, ChangeType.DidChange); -// } -// } -// SourceListItem _Display2SourceInfo; - -// /// -// /// If an audio dialer is available for this room -// /// -// public bool HasAudioDialer { get { return false; } } -// /// -// /// -// /// -// /// -// /// -// public EssentialsPresentationRoom(string key, string name, -// Dictionary displays, -// IBasicVolumeWithFeedback defaultVolume, EssentialsPresentationRoomPropertiesConfig config) -// : base(key, name) -// { -// Config = config; -// Displays = displays; - -// DefaultVolumeControls = defaultVolume; -// CurrentVolumeControls = defaultVolume; - -// //DefaultAudioDevice = defaultAudio; -// //if (defaultAudio is IBasicVolumeControls) -// // DefaultVolumeControls = defaultAudio as IBasicVolumeControls; -// //else if (defaultAudio is IHasVolumeDevice) -// // DefaultVolumeControls = (defaultAudio as IHasVolumeDevice).VolumeDevice; - - -// SourceListKey = "default"; -// EnablePowerOnToLastSource = true; -// } - -// /// -// /// Run the same source to all destinations -// /// -// /// -// public void RouteSourceToAllDestinations(SourceListItem sourceItem) -// { -// if (Config.Volumes.Master != null) -// { -// var audioDev = DeviceManager.GetDeviceForKey(Config.Volumes.Master.DeviceKey); -// if (audioDev is IBasicVolumeWithFeedback) -// { - -// } -// } - -// foreach (var display in Displays.Values) -// { -// if (sourceItem != null) -// DoVideoRoute(sourceItem.SourceKey, display.Key); -// else -// DoVideoRoute("$off", display.Key); -// } -// Display1SourceInfo = sourceItem; -// Display2SourceInfo = sourceItem; -// CurrentSingleSourceInfo = sourceItem; -// OnFeedback.FireUpdate(); -// } - -// public void SourceToDisplay1(SourceListItem sourceItem) -// { -// DoVideoRoute(sourceItem.SourceKey, Displays[1].Key); -// Display1SourceInfo = sourceItem; -// OnFeedback.FireUpdate(); -// } - -// public void SourceToDisplay2(SourceListItem sourceItem) -// { -// DoVideoRoute(sourceItem.SourceKey, Displays[2].Key); -// Display2SourceInfo = sourceItem; -// OnFeedback.FireUpdate(); -// } - - -// /// -// /// Basic source -> destination routing -// /// -// void DoVideoRoute(string sourceKey, string destinationKey) -// { -// new CTimer(o => -// { -// var dest = DeviceManager.GetDeviceForKey(destinationKey) as IRoutingSinkNoSwitching; -// if (dest == null) -// { -// Debug.Console(1, this, "Cannot route. Destination '{0}' not found", destinationKey); -// return; -// } -// // off is special case -// if (sourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) -// { -// dest.ReleaseRoute(); -// if (dest is IPower) -// (dest as IPower).PowerOff(); -// return; -// } - -// var source = DeviceManager.GetDeviceForKey(sourceKey) as IRoutingOutputs; -// if (source == null) -// { -// Debug.Console(1, this, "Cannot route. Source '{0}' not found", sourceKey); -// return; -// } -// dest.ReleaseAndMakeRoute(source, eRoutingSignalType.Video); -// }, 0); -// } - -// /// -// /// -// /// -// protected override void EndShutdown() -// { -// RunRouteAction("roomoff"); -// } - -// /// -// /// -// /// -// /// -// public void RunRouteAction(string routeKey) -// { -// RunRouteAction(routeKey, null); -// } - -// /// -// /// Gets a source from config list SourceListKey and dynamically build and executes the -// /// route or commands -// /// -// /// -// public void RunRouteAction(string routeKey, Action successCallback) -// { -// // Run this on a separate thread -// new CTimer(o => -// { -// Debug.Console(1, this, "Run room action '{0}'", routeKey); -// var dict = ConfigReader.ConfigObject.GetSourceListForKey(SourceListKey); -// if(dict == null) -// { -// Debug.Console(1, this, "WARNING: Config source list '{0}' not found", SourceListKey); -// return; -// } - -// // Try to get the list item by it's string key -// if (!dict.ContainsKey(routeKey)) -// { -// Debug.Console(1, this, "WARNING: No item '{0}' found on config list '{1}'", -// routeKey, SourceListKey); -// return; -// } - -// var item = dict[routeKey]; -// //Debug.Console(2, this, "Action {0} has {1} steps", -// // item.SourceKey, item.RouteList.Count); - -// // Let's run it -// if (routeKey.ToLower() != "roomoff") -// LastSourceKey = routeKey; - -// foreach (var route in item.RouteList) -// { -// // if there is a $defaultAll on route, run two separate -// if (route.DestinationKey.Equals("$defaultAll", StringComparison.OrdinalIgnoreCase)) -// { -// var tempAudio = new SourceRouteListItem -// { -// DestinationKey = "$defaultDisplay", -// SourceKey = route.SourceKey, -// Type = eRoutingSignalType.Video -// }; -// DoRoute(tempAudio); - -// var tempVideo = new SourceRouteListItem -// { -// DestinationKey = "$defaultAudio", -// SourceKey = route.SourceKey, -// Type = eRoutingSignalType.Audio -// }; -// DoRoute(tempVideo); -// continue; -// } -// else -// DoRoute(route); -// } - -// // Set volume control on room, using default if non provided -// IBasicVolumeControls volDev = null; -// // Handle special cases for volume control -// if (string.IsNullOrEmpty(item.VolumeControlKey) -// || item.VolumeControlKey.Equals("$defaultAudio", StringComparison.OrdinalIgnoreCase)) -// volDev = DefaultVolumeControls; -// //else if (item.VolumeControlKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) -// // volDev = DefaultDisplay as IBasicVolumeControls; -// // Or a specific device, probably rarely used. -// else -// { -// var dev = DeviceManager.GetDeviceForKey(item.VolumeControlKey); -// if (dev is IBasicVolumeControls) -// volDev = dev as IBasicVolumeControls; -// else if (dev is IHasVolumeDevice) -// volDev = (dev as IHasVolumeDevice).VolumeDevice; -// } -// CurrentVolumeControls = volDev; - -// // store the name and UI info for routes -// if (item.SourceKey != null) -// CurrentSingleSourceInfo = item; -// // And finally, set the "control". This will trigger event -// //CurrentControlDevice = DeviceManager.GetDeviceForKey(item.SourceKey) as Device; - -// OnFeedback.FireUpdate(); - -// // report back when done -// if (successCallback != null) -// successCallback(); -// }, 0); // end of CTimer -// } - -// /// -// /// Will power the room on with the last-used source -// /// -// public void PowerOnToDefaultOrLastSource() -// { -// if (!EnablePowerOnToLastSource || LastSourceKey == null) -// return; -// RunRouteAction(LastSourceKey); -// } - -// /// -// /// Does what it says -// /// -// public override void SetDefaultLevels() -// { -// Debug.Console(0, this, "SetDefaultLevels not implemented"); -// } - -// /// -// /// -// /// -// /// -// /// -// bool DoRoute(SourceRouteListItem route) -// { -// IRoutingSinkNoSwitching dest = null; - -// if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) -// dest = DefaultAudioDevice; -// //else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) -// // dest = DefaultDisplay; -// else -// dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; - -// if (dest == null) -// { -// Debug.Console(1, this, "Cannot route, unknown destination '{0}'", route.DestinationKey); -// return false; -// } - -// if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) -// { -// dest.ReleaseRoute(); -// if (dest is IPower) -// (dest as IPower).PowerOff(); -// } -// else -// { -// var source = DeviceManager.GetDeviceForKey(route.SourceKey) as IRoutingOutputs; -// if (source == null) -// { -// Debug.Console(1, this, "Cannot route unknown source '{0}' to {1}", route.SourceKey, route.DestinationKey); -// return false; -// } -// dest.ReleaseAndMakeRoute(source, route.Type); -// } -// return true; -// } - -// public override void RoomVacatedForTimeoutPeriod(object o) -// { -// //Implement this -// } - -// } -//} \ No newline at end of file diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 11f720a3..df1ecdce 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -106,12 +106,18 @@ namespace PepperDash.Essentials Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason); // Give up cleanly if SGD is not present. - var sgdName = Global.FilePathPrefix - + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile; + var sgdName = Global.FilePathPrefix + "sgd" + Global.DirectorySeparator + props.SgdFile; if (!File.Exists(sgdName)) { - Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName); - return; + Debug.Console(0, this, "Smart object file '{0}' not present in User folder. Looking for embedded file", sgdName); + + sgdName = Global.ApplicationDirectoryPathPrefix + Global.DirectorySeparator + "SGD" + Global.DirectorySeparator + props.SgdFile; + + if (!File.Exists(sgdName)) + { + Debug.Console(0, this, "Unable to find SGD file '{0}' in User sgd or application SGD folder. Exiting touchpanel load.", sgdName); + return; + } } Panel.LoadSmartObjects(sgdName); diff --git a/README.md b/README.md index 377a7131..05f0953c 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,44 @@ -# Pepperdash Essentials -## RELEASE PROCESS CONTROLLED BY JENKINS CI PROCESS +# PepperDash Essentials Framework (c) 2020 -#### How to merge +## License +Provided under MIT license + +## Overview +PepperDash Essentials is an open source Crestron framework that can be configured as a standalone program capable of running a wide variety of system designs and can also be utilized as a plug-in architecture to augment other Simpl# Pro and Simpl Windows programs. + +Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other. + +## Minimum Requirements +- Essentials Framework runs on any Crestron 3-series processor or Crestron's VC-4 platform. +- To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required. +- Crestron's Simpl# Plugin is also required (must be obtained from Crestron). + +## Dependencies + +The [PepperDash.Core](https://github.com/PepperDash/PepperDashCore) SIMPL# library is required. It is referenced as a submodule and will be automatically checked out when cloning this repo if set to recurse submodules. This allows different builds of the PepperDash.Core library to be referenced by checking out the desired submodule commit. + +## Utilization +Essentials was originally conceptualized as a standalone application for running control system logic entirely in Simpl# Pro. It is primarily designed around accomplishing this goal, but during development, it became obvious that it could easily be leveraged to also serve as a partner application to one or more SIMPL Windows programs. + +Utilization of Essentials Framework falls into the following categories: + +1. Standalone Control System Application for controlling one or more rooms. See [Standalone Use](https://github.com/PepperDash/Essentials/wiki/Standalone-Use#standalone-application) + +2. Partner Application to a SIMPL Windows program. This allows for several useful advantages. See [SIMPL Windows Bridging](https://github.com/PepperDash/Essentials/wiki/SIMPL-Bridging#simpl-windows-bridging) + +- Dynamic device instantiation. Devices can be defined in configuration and instantiated at runtime and then bridged to a SIMPL Windows program via EISC. + +- Advanced logic. Some logic operations that cannot be affectively accomplished in SIMPL Windows (ex. JSON/XML serialization/deserialization, database operations, etc.) can be done in the Simpl# Pro environment and the necessary input and output bridged to a SIMPL Windows program via EISC. + +3. Hybrid Application that may contain elements of both standalone control and SIMPL partner application integration. +- There may be a use case where a device can only be defined in a single application, but that device may need to be interacted with from multiple applications. The device can be defined in an Essentials application, interacted with in that application and also bridged to one or more SIMPL Windows applications. + + ## Documentation + For detailed documentation, see the [Wiki](https://github.com/PepperDash/EssentialsFramework/wiki). + +## How-To (Getting Started) + +See [Getting Started](https://github.com/PepperDash/Essentials/wiki/Get-started#how-to-get-started) - -- Make changes -- Build -- Test on your system -- Commit and push to essentials -- Curse a whole lot when you try to figure out how to then get developments all synced up diff --git a/docs/Plugin Load Sequence.png b/docs/Plugin Load Sequence.png new file mode 100644 index 00000000..d7c4732c Binary files /dev/null and b/docs/Plugin Load Sequence.png differ diff --git a/docs/arch-high-level.png b/docs/arch-high-level.png new file mode 100644 index 00000000..57b03940 Binary files /dev/null and b/docs/arch-high-level.png differ diff --git a/docs/arch-overview.png b/docs/arch-overview.png new file mode 100644 index 00000000..3dbb18ec Binary files /dev/null and b/docs/arch-overview.png differ diff --git a/docs/arch-table.PNG b/docs/arch-table.PNG new file mode 100644 index 00000000..6542cbb0 Binary files /dev/null and b/docs/arch-table.PNG differ diff --git a/docs/comm-device-factory.png b/docs/comm-device-factory.png new file mode 100644 index 00000000..edaca0a1 Binary files /dev/null and b/docs/comm-device-factory.png differ diff --git a/docs/lifecycle.png b/docs/lifecycle.png new file mode 100644 index 00000000..33697a84 Binary files /dev/null and b/docs/lifecycle.png differ diff --git a/docs/routing-system-diagram.png b/docs/routing-system-diagram.png new file mode 100644 index 00000000..b3f07588 Binary files /dev/null and b/docs/routing-system-diagram.png differ diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CecPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CecPortController.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComPortController.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComSpecJsonConverter.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComSpecJsonConverter.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComSpecJsonConverter.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComSpecJsonConverter.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommunicationExtras.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommunicationExtras.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommunicationExtras.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommunicationExtras.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/DELETE ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/DELETE ComPortController.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/GenericHttpClient.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericHttpClient.cs similarity index 98% rename from essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/GenericHttpClient.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericHttpClient.cs index 53b4efd6..87cde373 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/GenericHttpClient.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericHttpClient.cs @@ -7,7 +7,7 @@ using Crestron.SimplSharp.Net.Http; using PepperDash.Core; using PepperDash.Core.DebugThings; -namespace PepperDash.Essentials.Devices.Common +namespace PepperDash.Essentials.Core { public class GenericHttpClient : Device, IBasicCommunication { @@ -23,7 +23,6 @@ namespace PepperDash.Essentials.Devices.Common } - /// /// /// @@ -53,6 +52,7 @@ namespace PepperDash.Essentials.Devices.Common Client.Dispatch(request); Debug.Console(2, this, "GenericHttpClient SentRequest TX:'{0}'", url); } + private void Response(HttpClientResponse response, HTTP_CALLBACK_ERROR error, object request) { if (error == HTTP_CALLBACK_ERROR.COMPLETED) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Constants/CommonCues.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Constants/CommonCues.cs deleted file mode 100644 index fceb9ad7..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Constants/CommonCues.cs +++ /dev/null @@ -1,127 +0,0 @@ -using Crestron.SimplSharpPro; - -namespace PepperDash.Essentials.Core -{ - public static class CommonBoolCue - { - public static readonly Cue Power = new Cue("Power", 101, eCueType.Bool); - public static readonly Cue PowerOn = new Cue("PowerOn", 102, eCueType.Bool); - public static readonly Cue PowerOff = new Cue("PowerOff", 103, eCueType.Bool); - - public static readonly Cue HasPowerFeedback = new Cue("HasPowerFeedback", 101, eCueType.Bool); - public static readonly Cue PowerOnFeedback = new Cue("PowerOnFeedback", 102, eCueType.Bool); - public static readonly Cue IsOnlineFeedback = new Cue("IsOnlineFeedback", 104, eCueType.Bool); - public static readonly Cue IsWarmingUp = new Cue("IsWarmingUp", 105, eCueType.Bool); - public static readonly Cue IsCoolingDown = new Cue("IsCoolingDown", 106, eCueType.Bool); - - public static readonly Cue Dash = new Cue("Dash", 109, eCueType.Bool); - public static readonly Cue Digit0 = new Cue("Digit0", 110, eCueType.Bool); - public static readonly Cue Digit1 = new Cue("Digit1", 111, eCueType.Bool); - public static readonly Cue Digit2 = new Cue("Digit2", 112, eCueType.Bool); - public static readonly Cue Digit3 = new Cue("Digit3", 113, eCueType.Bool); - public static readonly Cue Digit4 = new Cue("Digit4", 114, eCueType.Bool); - public static readonly Cue Digit5 = new Cue("Digit5", 115, eCueType.Bool); - public static readonly Cue Digit6 = new Cue("Digit6", 116, eCueType.Bool); - public static readonly Cue Digit7 = new Cue("Digit7", 117, eCueType.Bool); - public static readonly Cue Digit8 = new Cue("Digit8", 118, eCueType.Bool); - public static readonly Cue Digit9 = new Cue("Digit9", 119, eCueType.Bool); - public static readonly Cue KeypadMisc1 = new Cue("KeypadMisc1", 120, eCueType.Bool); - public static readonly Cue KeypadMisc2 = new Cue("KeypadMisc2", 121, eCueType.Bool); - - public static readonly Cue NumericEnter = new Cue("Enter", 122, eCueType.Bool); - public static readonly Cue ChannelUp = new Cue("ChannelUp", 123, eCueType.Bool); - public static readonly Cue ChannelDown = new Cue("ChannelDown", 124, eCueType.Bool); - public static readonly Cue Last = new Cue("Last", 125, eCueType.Bool); - public static readonly Cue OpenClose = new Cue("OpenClose", 126, eCueType.Bool); - public static readonly Cue Subtitle = new Cue("Subtitle", 127, eCueType.Bool); - public static readonly Cue Audio = new Cue("Audio", 128, eCueType.Bool); - public static readonly Cue Info = new Cue("Info", 129, eCueType.Bool); - public static readonly Cue Menu = new Cue("Menu", 130, eCueType.Bool); - public static readonly Cue DeviceMenu = new Cue("DeviceMenu", 131, eCueType.Bool); - public static readonly Cue Return = new Cue("Return", 132, eCueType.Bool); - public static readonly Cue Back = new Cue("Back", 133, eCueType.Bool); - public static readonly Cue Exit = new Cue("Exit", 134, eCueType.Bool); - public static readonly Cue Clear = new Cue("Clear", 135, eCueType.Bool); - public static readonly Cue List = new Cue("List", 136, eCueType.Bool); - public static readonly Cue Guide = new Cue("Guide", 137, eCueType.Bool); - public static readonly Cue Am = new Cue("Am", 136, eCueType.Bool); - public static readonly Cue Fm = new Cue("Fm", 137, eCueType.Bool); - public static readonly Cue Up = new Cue("Up", 138, eCueType.Bool); - public static readonly Cue Down = new Cue("Down", 139, eCueType.Bool); - public static readonly Cue Left = new Cue("Left", 140, eCueType.Bool); - public static readonly Cue Right = new Cue("Right", 141, eCueType.Bool); - public static readonly Cue Select = new Cue("Select", 142, eCueType.Bool); - public static readonly Cue SmartApps = new Cue("SmartApps", 143, eCueType.Bool); - public static readonly Cue Dvr = new Cue("Dvr", 144, eCueType.Bool); - - public static readonly Cue Play = new Cue("Play", 145, eCueType.Bool); - public static readonly Cue Pause = new Cue("Pause", 146, eCueType.Bool); - public static readonly Cue Stop = new Cue("Stop", 147, eCueType.Bool); - public static readonly Cue ChapNext = new Cue("ChapNext", 148, eCueType.Bool); - public static readonly Cue ChapPrevious = new Cue("ChapPrevious", 149, eCueType.Bool); - public static readonly Cue Rewind = new Cue("Rewind", 150, eCueType.Bool); - public static readonly Cue Ffwd = new Cue("Ffwd", 151, eCueType.Bool); - public static readonly Cue Replay = new Cue("Replay", 152, eCueType.Bool); - public static readonly Cue Advance = new Cue("Advance", 153, eCueType.Bool); - public static readonly Cue Record = new Cue("Record", 154, eCueType.Bool); - public static readonly Cue Red = new Cue("Red", 155, eCueType.Bool); - public static readonly Cue Green = new Cue("Green", 156, eCueType.Bool); - public static readonly Cue Yellow = new Cue("Yellow", 157, eCueType.Bool); - public static readonly Cue Blue = new Cue("Blue", 158, eCueType.Bool); - public static readonly Cue Home = new Cue("Home", 159, eCueType.Bool); - public static readonly Cue PopUp = new Cue("PopUp", 160, eCueType.Bool); - public static readonly Cue PageUp = new Cue("PageUp", 161, eCueType.Bool); - public static readonly Cue PageDown = new Cue("PageDown", 162, eCueType.Bool); - public static readonly Cue Search = new Cue("Search", 163, eCueType.Bool); - public static readonly Cue Setup = new Cue("Setup", 164, eCueType.Bool); - public static readonly Cue RStep = new Cue("RStep", 165, eCueType.Bool); - public static readonly Cue FStep = new Cue("FStep", 166, eCueType.Bool); - - public static readonly Cue IsConnected = new Cue("IsConnected", 281, eCueType.Bool); - public static readonly Cue IsOk = new Cue("IsOk", 282, eCueType.Bool); - public static readonly Cue InWarning = new Cue("InWarning", 283, eCueType.Bool); - public static readonly Cue InError = new Cue("InError", 284, eCueType.Bool); - public static readonly Cue StatusUnknown = new Cue("StatusUnknown", 285, eCueType.Bool); - - public static readonly Cue VolumeUp = new Cue("VolumeUp", 401, eCueType.Bool); - public static readonly Cue VolumeDown = new Cue("VolumeDown", 402, eCueType.Bool); - public static readonly Cue MuteOn = new Cue("MuteOn", 403, eCueType.Bool); - public static readonly Cue MuteOff = new Cue("MuteOff", 404, eCueType.Bool); - public static readonly Cue MuteToggle = new Cue("MuteToggle", 405, eCueType.Bool); - public static readonly Cue ShowVolumeButtons = new Cue("ShowVolumeButtons", 406, eCueType.Bool); - public static readonly Cue ShowVolumeSlider = new Cue("ShowVolumeSlider", 407, eCueType.Bool); - - public static readonly Cue Hdmi1 = new Cue("Hdmi1", 451, eCueType.Bool); - public static readonly Cue Hdmi2 = new Cue("Hdmi2", 452, eCueType.Bool); - public static readonly Cue Hdmi3 = new Cue("Hdmi3", 453, eCueType.Bool); - public static readonly Cue Hdmi4 = new Cue("Hdmi4", 454, eCueType.Bool); - public static readonly Cue Hdmi5 = new Cue("Hdmi5", 455, eCueType.Bool); - public static readonly Cue Hdmi6 = new Cue("Hdmi6", 456, eCueType.Bool); - public static readonly Cue DisplayPort1 = new Cue("DisplayPort1", 457, eCueType.Bool); - public static readonly Cue DisplayPort2 = new Cue("DisplayPort2", 458, eCueType.Bool); - public static readonly Cue Dvi1 = new Cue("Dvi1", 459, eCueType.Bool); - public static readonly Cue Dvi2 = new Cue("Dvi2", 460, eCueType.Bool); - public static readonly Cue Video1 = new Cue("Video1", 461, eCueType.Bool); - public static readonly Cue Video2 = new Cue("Video2", 462, eCueType.Bool); - public static readonly Cue Component1 = new Cue("Component1", 463, eCueType.Bool); - public static readonly Cue Component2 = new Cue("Component2", 464, eCueType.Bool); - public static readonly Cue Vga1 = new Cue("Vga1", 465, eCueType.Bool); - public static readonly Cue Vga2 = new Cue("Vga2", 466, eCueType.Bool); - public static readonly Cue Rgb1 = new Cue("Rgb1", 467, eCueType.Bool); - public static readonly Cue Rgb2 = new Cue("Rgb2", 468, eCueType.Bool); - public static readonly Cue Antenna = new Cue("Antenna", 469, eCueType.Bool); - - public static readonly Cue InCall = new Cue("InCall", 501, eCueType.Bool); - } - - public static class CommonIntCue - { - public static readonly Cue MainVolumeLevel = new Cue("MainVolumeLevel", 401, eCueType.Int); - public static readonly Cue MainVolumeLevelFeedback = new Cue("MainVolumeLevelFeedback", 401, eCueType.Int); - } - - public static class CommonStringCue - { - public static readonly Cue IpConnectionsText = new Cue("IpConnectionsText", 9999, eCueType.String); - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs new file mode 100644 index 00000000..865acd1c --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -0,0 +1,44 @@ +using System; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + public class C2nRthsController:CrestronGenericBaseDevice + { + private C2nRths _device; + + public IntFeedback TemperatureFeedback { get; private set; } + public IntFeedback HumidityFeedback { get; private set; } + + public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware) + { + _device = hardware as C2nRths; + + TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); + HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); + + _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; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs new file mode 100644 index 00000000..6bdfc25c --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/CenIoDigIn104Controller.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.GeneralIO; + +using PepperDash.Core; + +namespace PepperDash.Essentials.Core +{ + /// + /// Wrapper class for CEN-IO-DIGIN-104 digital input module + /// + public class CenIoDigIn104Controller : Device, 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 + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs new file mode 100644 index 00000000..b83eae37 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -0,0 +1,107 @@ +using System; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + public class StatusSignController:CrestronGenericBaseDevice + { + 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, string name, GenericBase hardware) : base(key, name, hardware) + { + _device = hardware as StatusSign; + + 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); + + _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); + } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 08223e03..6d6a5fb4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -1,156 +1,169 @@ -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 -{ - /// - /// A bridge class to cover the basic features of GenericBase hardware - /// - public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking - { - public virtual GenericBase Hardware { get; protected set; } - - /// - /// Returns a list containing the Outputs that we want to expose. - /// - public FeedbackCollection Feedbacks { get; private set; } - - public BoolFeedback IsOnline { get; private set; } - public BoolFeedback IsRegistered { get; private set; } - public StringFeedback IpConnectionsText { get; private set; } - - /// - /// Used by implementing classes to prevent registration with Crestron TLDM. For - /// devices like RMCs and TXs attached to a chassis. - /// - public bool PreventRegistration { get; protected set; } - - public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) - : base(key, name) - { - Feedbacks = new FeedbackCollection(); - - Hardware = hardware; - IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); - IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); - IpConnectionsText = new StringFeedback("IpConnectionsText", () => - string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray())); - - AddToFeedbackList(IsOnline, IsRegistered, IpConnectionsText); - - CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); - } - - /// - /// Make sure that overriding classes call this! - /// Registers the Crestron device, connects up to the base events, starts communication monitor - /// - public override bool CustomActivate() - { - Debug.Console(0, this, "Activating"); - if (!PreventRegistration) - { - //Debug.Console(1, this, " Does not require registration. Skipping"); - - var response = Hardware.RegisterWithLogging(Key); - if (response != eDeviceRegistrationUnRegistrationResponse.Success) - { - //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); - return false; - } - } - - Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); - CommunicationMonitor.Start(); - - return true; - } - - /// - /// This disconnects events and unregisters the base hardware device. - /// - /// - public override bool Deactivate() - { - CommunicationMonitor.Stop(); - Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange; - - return Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; - } - - /// - /// Adds feedback(s) to the list - /// - /// - public void AddToFeedbackList(params Feedback[] newFbs) - { - foreach (var f in newFbs) - { - if (f != null) - { - if (!Feedbacks.Contains(f)) - { - Feedbacks.Add(f); - } - } - } - } - - void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) - { - if (args.DeviceOnLine) - { - foreach (var feedback in Feedbacks) - { - if (feedback != null) - feedback.FireUpdate(); - } - } - } - - #region IStatusMonitor Members - - public StatusMonitorBase CommunicationMonitor { get; private set; } - #endregion - - #region IUsageTracking Members - - public UsageTracking UsageTracker { get; set; } - - #endregion - } - - //*********************************************************************************** - public class CrestronGenericBaseDeviceEventIds - { - public const uint IsOnline = 1; - public const uint IpConnectionsText =2; - } - - /// - /// Adds logging to Register() failure - /// - public static class GenericBaseExtensions - { - public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key) - { - var result = device.Register(); - var level = result == eDeviceRegistrationUnRegistrationResponse.Success ? - Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error; - Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result); - //if (result != eDeviceRegistrationUnRegistrationResponse.Success) - //{ - // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result); - //} - return result; - } - - } +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 +{ + /// + /// A bridge class to cover the basic features of GenericBase hardware + /// + public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking + { + public virtual GenericBase Hardware { get; protected set; } + + /// + /// Returns a list containing the Outputs that we want to expose. + /// + public FeedbackCollection Feedbacks { get; private set; } + + public BoolFeedback IsOnline { get; private set; } + public BoolFeedback IsRegistered { get; private set; } + public StringFeedback IpConnectionsText { get; private set; } + + /// + /// Used by implementing classes to prevent registration with Crestron TLDM. For + /// devices like RMCs and TXs attached to a chassis. + /// + public bool PreventRegistration { get; protected set; } + + public CrestronGenericBaseDevice(string key, string name, GenericBase hardware) + : base(key, name) + { + Feedbacks = new FeedbackCollection(); + + Hardware = hardware; + IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); + IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); + IpConnectionsText = new StringFeedback("IpConnectionsText", () => + { + if (Hardware.ConnectedIpList != null) + return string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()); + else + return string.Empty; + }); + AddToFeedbackList(IsOnline, IpConnectionsText); + + CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); + } + + /// + /// Make sure that overriding classes call this! + /// Registers the Crestron device, connects up to the base events, starts communication monitor + /// + public override bool CustomActivate() + { + Debug.Console(0, this, "Activating"); + if (!PreventRegistration) + { + //Debug.Console(1, this, " Does not require registration. Skipping"); + + var response = Hardware.RegisterWithLogging(Key); + if (response != eDeviceRegistrationUnRegistrationResponse.Success) + { + //Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response); + return false; + } + + IsRegistered.FireUpdate(); + } + + foreach (var f in Feedbacks) + { + f.FireUpdate(); + } + + Hardware.OnlineStatusChange += new OnlineStatusChangeEventHandler(Hardware_OnlineStatusChange); + CommunicationMonitor.Start(); + + return true; + } + + /// + /// This disconnects events and unregisters the base hardware device. + /// + /// + public override bool Deactivate() + { + CommunicationMonitor.Stop(); + Hardware.OnlineStatusChange -= Hardware_OnlineStatusChange; + + var success = Hardware.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; + + IsRegistered.FireUpdate(); + + return success; + } + + /// + /// Adds feedback(s) to the list + /// + /// + public void AddToFeedbackList(params Feedback[] newFbs) + { + foreach (var f in newFbs) + { + if (f != null) + { + if (!Feedbacks.Contains(f)) + { + Feedbacks.Add(f); + } + } + } + } + + void Hardware_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + Debug.Console(2, this, "OnlineStatusChange Event. Online = {0}", args.DeviceOnLine); + foreach (var feedback in Feedbacks) + { + if (feedback != null) + feedback.FireUpdate(); + } + } + + #region IStatusMonitor Members + + public StatusMonitorBase CommunicationMonitor { get; private set; } + #endregion + + #region IUsageTracking Members + + public UsageTracking UsageTracker { get; set; } + + #endregion + } + + //*********************************************************************************** + public class CrestronGenericBaseDeviceEventIds + { + public const uint IsOnline = 1; + public const uint IpConnectionsText =2; + } + + /// + /// Adds logging to Register() failure + /// + public static class GenericBaseExtensions + { + public static eDeviceRegistrationUnRegistrationResponse RegisterWithLogging(this GenericBase device, string key) + { + var result = device.Register(); + var level = result == eDeviceRegistrationUnRegistrationResponse.Success ? + Debug.ErrorLogLevel.Notice : Debug.ErrorLogLevel.Error; + Debug.Console(0, level, "Register device result: '{0}', type '{1}', result {2}", key, device, result); + //if (result != eDeviceRegistrationUnRegistrationResponse.Success) + //{ + // Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot register device '{0}': {1}", key, result); + //} + return result; + } + + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Cues and DevAction/Cues.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Cues and DevAction/Cues.cs deleted file mode 100644 index a3940a98..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Cues and DevAction/Cues.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - - -namespace PepperDash.Essentials.Core -{ - /// - /// Encapsulates a string-named, joined and typed command to a device - /// - [Obsolete()] - public class DevAction - { - public Cue Cue { get; private set; } - public Action Action { get; private set; } - - - public DevAction(Cue cue, Action action) - { - Cue = cue; - Action = action; - } - } - - public enum eCueType - { - Bool, Int, String, Serial, Void, Other - } - - - /// - /// The Cue class is a container to represent a name / join number / type for simplifying - /// commands coming into devices. - /// - public class Cue - { - public string Name { get; private set; } - public uint Number { get; private set; } - public eCueType Type { get; private set; } - - public Cue(string name, uint join, eCueType type) - { - Name = name; - Number = join; - Type = type; - } - - /// - /// Override that prints out the cue's data - /// - public override string ToString() - { - return string.Format("{0} Cue '{1}'-{2}", Type, Name, Number); - } - - ///// - ///// Returns a new Cue with JoinNumber offset - ///// - //public Cue GetOffsetCopy(uint offset) - //{ - // return new Cue(Name, Number + offset, Type); - //} - - /// - /// Helper method to create a Cue of Bool type - /// - /// Cue - public static Cue BoolCue(string name, uint join) - { - return new Cue(name, join, eCueType.Bool); - } - - /// - /// Helper method to create a Cue of ushort type - /// - /// Cue - public static Cue UShortCue(string name, uint join) - { - return new Cue(name, join, eCueType.Int); - } - - /// - /// Helper method to create a Cue of string type - /// - /// Cue - public static Cue StringCue(string name, uint join) - { - return new Cue(name, join, eCueType.String); - } - - public static readonly Cue DefaultBoolCue = new Cue("-none-", 0, eCueType.Bool); - public static readonly Cue DefaultIntCue = new Cue("-none-", 0, eCueType.Int); - public static readonly Cue DefaultStringCue = new Cue("-none-", 0, eCueType.String); - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/AudioInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/AudioInterfaces.cs new file mode 100644 index 00000000..90aa4909 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/AudioInterfaces.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +namespace PepperDash.Essentials.Core +{ + + public enum AudioChangeType + { + Mute, Volume + } + + public class AudioChangeEventArgs + { + public AudioChangeType ChangeType { get; private set; } + public IBasicVolumeControls AudioDevice { get; private set; } + + public AudioChangeEventArgs(IBasicVolumeControls device, AudioChangeType changeType) + { + ChangeType = changeType; + AudioDevice = device; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks.cs index a21d2a3a..cc5e1054 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks.cs @@ -26,9 +26,7 @@ namespace PepperDash.Essentials.Core // get the properties and set them into a new collection of NameType wrappers var props = t.GetProperties().Select(p => new PropertyNameType(p, t)); - - - var feedbacks = source.Feedbacks.OrderBy(x => x.Type); + var feedbacks = source.Feedbacks; if (feedbacks != null) { Debug.Console(0, source, "\n\nAvailable feedbacks:"); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs index c67afe1c..67a74ed7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs @@ -120,26 +120,5 @@ namespace PepperDash.Essentials.Core Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command); } - - ///// - ///// When fed a dictionary of uint, string, will return UOs for each item, - ///// attached to this IrOutputPort - ///// - ///// - ///// - //public List GetUOsForIrCommands(Dictionary numStringDict) - //{ - // var funcs = new List(numStringDict.Count); - // foreach (var kvp in numStringDict) - // { - // // Have to assign these locally because of kvp's scope - // var cue = kvp.Key; - // var command = kvp.Value; - // funcs.Add(new BoolCueActionPair(cue, b => this.PressRelease(command, b))); - // } - // return funcs; - //} - - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/NewInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/NewInterfaces.cs deleted file mode 100644 index ca6524f4..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/NewInterfaces.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -namespace PepperDash.Essentials.Core -{ - //public interface IVolumeFunctions - //{ - // BoolCueActionPair VolumeUpCueActionPair { get; } - // BoolCueActionPair VolumeDownCueActionPair { get; } - // BoolCueActionPair MuteToggleCueActionPair { get; } - //} - - //public interface IVolumeTwoWay : IVolumeFunctions - //{ - // IntFeedback VolumeLevelFeedback { get; } - // UShortCueActionPair VolumeLevelCueActionPair { get; } - // BoolFeedback IsMutedFeedback { get; } - //} - - ///// - ///// - ///// - //public static class IFunctionListExtensions - //{ - // public static string GetFunctionsConsoleList(this IHasCueActionList device) - // { - // var sb = new StringBuilder(); - // var list = device.CueActionList; - // foreach (var cap in list) - // sb.AppendFormat("{0,-15} {1,4} {2}\r", cap.Cue.Name, cap.Cue.Number, cap.GetType().Name); - // return sb.ToString(); - // } - //} - - public enum AudioChangeType - { - Mute, Volume - } - - public class AudioChangeEventArgs - { - public AudioChangeType ChangeType { get; private set; } - public IBasicVolumeControls AudioDevice { get; private set; } - - public AudioChangeEventArgs(IBasicVolumeControls device, AudioChangeType changeType) - { - ChangeType = changeType; - AudioDevice = device; - } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DELETE IRDisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DELETE IRDisplayBase.cs deleted file mode 100644 index 06b4da07..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DELETE IRDisplayBase.cs +++ /dev/null @@ -1,105 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; - -//namespace PepperDash.Essentials.Core -//{ -// public abstract class IRDisplayBase : DisplayBase, IHasCueActionList -// { -// public IrOutputPortController IrPort { get; private set; } -// /// -// /// Default to 200ms -// /// -// public ushort IrPulseTime { get; set; } -// bool _PowerIsOn; -// bool _IsWarmingUp; -// bool _IsCoolingDown; - -// /// -// /// FunctionList is pre-defined to have power commands. -// /// -// public IRDisplayBase(string key, string name, IROutputPort port, string irDriverFilepath) -// : base(key, name) -// { -// IrPort = new IrOutputPortController("ir-" + key, port, irDriverFilepath); -// IrPulseTime = 200; -// WarmupTime = 7000; -// CooldownTime = 10000; - -// CueActionList = new List -// { -// new BoolCueActionPair(CommonBoolCue.Power, b=> PowerToggle()), -// new BoolCueActionPair(CommonBoolCue.PowerOn, b=> PowerOn()), -// new BoolCueActionPair(CommonBoolCue.PowerOff, b=> PowerOff()), -// }; -// } - -// public override void PowerOn() -// { -// if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown) -// { -// _IsWarmingUp = true; -// IsWarmingUpFeedback.FireUpdate(); -// // Fake power-up cycle -// WarmupTimer = new CTimer(o => -// { -// _IsWarmingUp = false; -// _PowerIsOn = true; -// IsWarmingUpFeedback.FireUpdate(); -// PowerIsOnFeedback.FireUpdate(); -// }, WarmupTime); -// } -// IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); -// } - -// public override void PowerOff() -// { -// // If a display has unreliable-power off feedback, just override this and -// // remove this check. -// if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown) -// { -// _IsCoolingDown = true; -// _PowerIsOn = false; -// PowerIsOnFeedback.FireUpdate(); -// IsCoolingDownFeedback.FireUpdate(); -// // Fake cool-down cycle -// CooldownTimer = new CTimer(o => -// { -// _IsCoolingDown = false; -// IsCoolingDownFeedback.FireUpdate(); -// }, CooldownTime); -// } -// IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); -// } - -// public override void PowerToggle() -// { -// // Not sure how to handle the feedback, but we should default to power off fb. -// // Does this need to trigger feedback?? -// _PowerIsOn = false; -// IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); -// } - -// #region IFunctionList Members - -// public List CueActionList -// { -// get; -// private set; -// } - -// #endregion - -// protected override Func PowerIsOnOutputFunc { get { return () => _PowerIsOn; } } -// protected override Func IsCoolingDownOutputFunc { get { return () => _IsCoolingDown; } } -// protected override Func IsWarmingUpOutputFunc { get { return () => _IsWarmingUp; } } - -// public override void ExecuteSwitch(object selector) -// { -// IrPort.Pulse((string)selector, IrPulseTime); -// } -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Ethernet/EthernetStatistics.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Ethernet/EthernetStatistics.cs index 13e49b5c..cbdd0617 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Ethernet/EthernetStatistics.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Ethernet/EthernetStatistics.cs @@ -30,15 +30,4 @@ namespace PepperDash.Essentials.Core.Ethernet () => CrestronEthernetHelper.GetEthernetParameter( CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0)); } - - public static class EthernetCue - { - public static readonly Cue LinkActive = Cue.BoolCue("LinkActive", 1); - public static readonly Cue DhcpActive = Cue.BoolCue("DhcpActive", 2); - - public static readonly Cue Hostname = Cue.StringCue("Hostname", 1); - public static readonly Cue IpAddress0 = Cue.StringCue("IpAddress0", 2); - public static readonly Cue SubnetMask0 = Cue.StringCue("SubnetMask0", 3); - public static readonly Cue DefaultGateway0 = Cue.StringCue("DefaultGateway0", 4); - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index cfe5af0a..8bc89bd4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -4,10 +4,11 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; - +using Crestron.SimplSharpPro.GeneralIO; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.CrestronIO; namespace PepperDash.Essentials.Core { @@ -52,6 +53,27 @@ namespace PepperDash.Essentials.Core Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); return new GenericComm(dc); } + else if (typeName == "ceniodigin104") + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var ipid = control.IpIdInt; + + return new CenIoDigIn104Controller(key, name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem)); + } + if (typeName == "statussign") + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(key, name, new StatusSign(cresnetId, Global.ControlSystem)); + } + if (typeName == "c2nrths") + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new C2nRthsController(key, name, new C2nRths(cresnetId, Global.ControlSystem)); + } // then check for types that have been added by plugin dlls. if (FactoryMethods.ContainsKey(typeName)) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/BoolFeedback.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/BoolFeedback.cs index a5be1fb4..9fb4c1e1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/BoolFeedback.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/BoolFeedback.cs @@ -19,8 +19,6 @@ namespace PepperDash.Essentials.Core public override bool BoolValue { get { return _BoolValue; } } bool _BoolValue; - public override eCueType Type { get { return eCueType.Bool; } } - /// /// Fake value to be used in test mode /// @@ -45,12 +43,6 @@ namespace PepperDash.Essentials.Core ValueFunc = valueFunc; } - //public BoolFeedback(Cue cue, Func valueFunc) - // : base(cue) - //{ - // if (cue == null) throw new ArgumentNullException("cue"); - // ValueFunc = valueFunc; - //} public override void FireUpdate() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/FeedbackBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/FeedbackBase.cs index 96571dce..c3aac50b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/FeedbackBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/FeedbackBase.cs @@ -20,10 +20,6 @@ namespace PepperDash.Essentials.Core public virtual string StringValue { get { return ""; } } public virtual string SerialValue { get { return ""; } } - //public Cue Cue { get; private set; } - - public abstract eCueType Type { get; } - /// /// Feedbacks can be put into test mode for simulation of events without real data. /// Using JSON debugging methods and the Set/ClearTestValue methods, we can simulate @@ -46,10 +42,7 @@ namespace PepperDash.Essentials.Core Key = key; } - //protected Feedback(Cue cue) - //{ - // Cue = cue; - //} + /// /// Clears test mode and fires update. diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/IntFeedback.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/IntFeedback.cs index 5591cb7f..4a278148 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/IntFeedback.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/IntFeedback.cs @@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core int _IntValue; public ushort UShortValue { get { return (ushort)_IntValue; } } - public override eCueType Type { get { return eCueType.Int; } } + //public override eCueType Type { get { return eCueType.Int; } } public int TestValue { get; private set; } @@ -34,13 +34,6 @@ namespace PepperDash.Essentials.Core ValueFunc = valueFunc; } - //public IntFeedback(Cue cue, Func valueFunc) - // : base(cue) - //{ - // if (cue == null) throw new ArgumentNullException("cue"); - // ValueFunc = valueFunc; - //} - public override void FireUpdate() { var newValue = InTestMode ? TestValue : ValueFunc.Invoke(); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/SerialFeedback.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/SerialFeedback.cs index 0e6ed424..bbf135dc 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/SerialFeedback.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/SerialFeedback.cs @@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core public override string SerialValue { get { return _SerialValue; } } string _SerialValue; - public override eCueType Type { get { return eCueType.Serial; } } + //public override eCueType Type { get { return eCueType.Serial; } } /// /// Used in testing. Set/Clear functions diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/StringFeedback.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/StringFeedback.cs index e4cd7084..b02c02f0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/StringFeedback.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Feedbacks/StringFeedback.cs @@ -12,8 +12,6 @@ namespace PepperDash.Essentials.Core public override string StringValue { get { return _StringValue; } } // ValueFunc.Invoke(); } } string _StringValue; - public override eCueType Type { get { return eCueType.String; } } - /// /// Used in testing. Set/Clear functions /// @@ -36,13 +34,7 @@ namespace PepperDash.Essentials.Core ValueFunc = valueFunc; } - //public StringFeedback(Cue cue, Func valueFunc) - // : base(cue) - //{ - // if (cue == null) throw new ArgumentNullException("cue"); - // ValueFunc = valueFunc; - //} public override void FireUpdate() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 6ce3446e..4ef68066 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -1,10 +1,16 @@ -using Crestron.SimplSharp; +using System; +using System.Text.RegularExpressions; +using Crestron.SimplSharp; +using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharpPro; -//using PepperDash.Essentials.Core.Http; +using PepperDash.Core; using PepperDash.Essentials.License; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Schema; namespace PepperDash.Essentials.Core @@ -20,6 +26,17 @@ namespace PepperDash.Essentials.Core /// public static string FilePathPrefix { get; private set; } + /// + /// The file path prefix to the applciation directory + /// + public static string ApplicationDirectoryPathPrefix + { + get + { + return Crestron.SimplSharp.CrestronIO.Directory.GetApplicationDirectory(); + } + } + /// /// Returns the directory separator character based on the running OS /// @@ -45,6 +62,81 @@ namespace PepperDash.Essentials.Core FilePathPrefix = prefix; } + static string _AssemblyVersion; + + /// + /// Gets the Assembly Version of Essentials + /// + /// The Assembly Version at Runtime + public static string AssemblyVersion + { + get + { + return _AssemblyVersion; + } + private set + { + _AssemblyVersion = value; + } + } + + /// + /// Sets the Assembly version to the version of the Essentials Library + /// + /// + public static void SetAssemblyVersion(string assemblyVersion) + { + AssemblyVersion = assemblyVersion; + } + + /// + /// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true. + /// + /// Minimum specified version in format of xx.yy.zz + /// Returns true if the running version meets or exceeds the minimum specified version + public static bool IsRunningMinimumVersionOrHigher(string minimumVersion) + { + Debug.Console(2, "Comparing running version '{0}' to minimum version '{1}'", AssemblyVersion, minimumVersion); + + var runtimeVersion = Regex.Match(AssemblyVersion, @"^(\d*).(\d*).(\d*)$"); + + var runtimeVersionMajor = Int16.Parse(runtimeVersion.Groups[1].Value); + var runtimeVersionMinor = Int16.Parse(runtimeVersion.Groups[2].Value); + var runtimeVersionBuild = Int16.Parse(runtimeVersion.Groups[3].Value); + + // Check for beta build version + if (runtimeVersionMajor == 0) + { + Debug.Console(2, "Running Beta Build. Bypassing Dependency Check."); + return true; + } + + var minVersion = Regex.Match(minimumVersion, @"^(\d*).(\d*).(\d*)$"); + + if(!minVersion.Success) + { + Debug.Console(2, "minimumVersion String does not match format xx.yy.zz"); + return false; + } + + var minVersionMajor = Int16.Parse(minVersion.Groups[1].Value); + var minVersionMinor = Int16.Parse(minVersion.Groups[2].Value); + var minVersionBuild = Int16.Parse(minVersion.Groups[3].Value); + + + + if (minVersionMajor > runtimeVersionMajor) + return false; + + if (minVersionMinor > runtimeVersionMinor) + return false; + + if (minVersionBuild > runtimeVersionBuild) + return false; + + return true; + } + static Global() { // Fire up CrestronDataStoreStatic diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 374151ff..3415abd2 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -34,7 +34,9 @@ namespace PepperDash.Essentials.Core } } - + /// + /// Base class for join maps + /// public abstract class JoinMapBase { /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/License/EssentialsLicenseManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/License/EssentialsLicenseManager.cs index c5f2d5e9..4afb85bf 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/License/EssentialsLicenseManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/License/EssentialsLicenseManager.cs @@ -83,16 +83,4 @@ namespace PepperDash.Essentials.License return string.Format("License Status: {0}", IsValid ? "Valid" : "Not Valid"); } } - - public class EssentialsLicenseManager - { - - } - - public class LicenseCue - { - public static Cue LicenseIsValid = Cue.BoolCue("LicenseIsValid", 15991); - - public static Cue LicenseMessage = Cue.StringCue("LicenseMessage", 15991); - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index ea0a189b..fe721fba 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -62,6 +62,10 @@ False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll + + False + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll + False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll @@ -107,19 +111,23 @@ - - + + + + + + @@ -149,16 +157,15 @@ - - - - - + + + + + - @@ -195,14 +202,13 @@ - + - + - @@ -225,25 +231,20 @@ - - - - - - + @@ -251,23 +252,17 @@ - - - - - - diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs new file mode 100644 index 00000000..7ac894c6 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/IPluginDeviceConfig.cs @@ -0,0 +1,11 @@ +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.Plugins +{ + public interface IPluginDeviceConfig + { + string MinimumEssentialsFrameworkVersion { get; } + IKeyed BuildDevice(DeviceConfig dc); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs new file mode 100644 index 00000000..f802211f --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginEntrypointAttribute.cs @@ -0,0 +1,19 @@ +using System; + +namespace PepperDash.Essentials.Core.Plugins +{ + [AttributeUsage(AttributeTargets.Class)] + public sealed class PluginEntryPointAttribute : Attribute + { + private readonly string _uniqueKey; + + public string UniqueKey { + get { return _uniqueKey; } + } + + public PluginEntryPointAttribute(string key) + { + _uniqueKey = key; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs index 187d57a6..c1b3b688 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs @@ -1,7 +1,11 @@ using System.Reflection; +using Crestron.SimplSharp.Reflection; + +[assembly: System.Reflection.AssemblyTitle("PepperDashEssentialsBase")] +[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] +[assembly: System.Reflection.AssemblyProduct("PepperDashEssentials")] +[assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash Technology Corp 2020")] +[assembly: System.Reflection.AssemblyVersion("0.0.0.*")] +[assembly: System.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] +[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] -[assembly: AssemblyTitle("PepperDashEssentialsBase")] -[assembly: AssemblyCompany("PepperDash Technology Corp")] -[assembly: AssemblyProduct("PepperDashEssentialsBase")] -[assembly: AssemblyCopyright("Copyright © Ppperdash 2019")] -[assembly: AssemblyVersion("1.4.2.*")] \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/REMOVE SigId.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/REMOVE SigId.cs deleted file mode 100644 index 884f1601..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/REMOVE SigId.cs +++ /dev/null @@ -1,37 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharpPro; - -//namespace PepperDash.Essentials.Core -//{ -// public class SigId -// { -// public uint Number { get; private set; } -// public eSigType Type { get; private set; } - -// public SigId(eSigType type, uint number) -// { -// Type = type; -// Number = number; -// } - -// public override bool Equals(object id) -// { -// if (id is SigId) -// { -// var sigId = id as SigId; -// return this.Number == sigId.Number && this.Type == sigId.Type; -// } -// else -// return base.Equals(id); -// } - -// public override int GetHashCode() -// { -// return base.GetHashCode(); -// } -// } - -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs index c5162ffc..bb57941e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs @@ -100,7 +100,8 @@ namespace PepperDash.Essentials.Core ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered ShutdownPromptSeconds = 60; - ShutdownVacancySeconds = 120; + ShutdownVacancySeconds = 120; + ShutdownType = eShutdownType.None; RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer"); @@ -140,7 +141,7 @@ namespace PepperDash.Essentials.Core case eVacancyMode.InShutdownWarning: { StartShutdown(eShutdownType.Vacancy); - Debug.Console(0, this, "Shutting Down due to vacancy."); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy."); break; } default: @@ -163,7 +164,7 @@ namespace PepperDash.Essentials.Core ShutdownType = type; ShutdownPromptTimer.Start(); - Debug.Console(0, this, "ShutdwonPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount); } public void StartRoomVacancyTimer(eVacancyMode mode) @@ -177,7 +178,7 @@ namespace PepperDash.Essentials.Core VacancyMode = mode; RoomVacancyShutdownTimer.Start(); - Debug.Console(0, this, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount); } /// @@ -213,6 +214,9 @@ namespace PepperDash.Essentials.Core return; } + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes); + // If status provider is fusion, set flag to remote if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase) OccupancyStatusProviderIsRemote = true; @@ -220,16 +224,14 @@ namespace PepperDash.Essentials.Core if(timeoutMinutes > 0) RoomVacancyShutdownSeconds = timeoutMinutes * 60; - Debug.Console(1, this, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds); + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds); RoomOccupancy = statusProvider; - OnRoomOccupancyIsSet(); - RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange; RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange; - Debug.Console(0, this, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key); + OnRoomOccupancyIsSet(); } void OnRoomOccupancyIsSet() @@ -254,13 +256,13 @@ namespace PepperDash.Essentials.Core { if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false) { - Debug.Console(1, this, "Notice: Vacancy Detected"); + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected"); // Trigger the timer when the room is vacant StartRoomVacancyTimer(eVacancyMode.InInitialVacancy); } else { - Debug.Console(1, this, "Notice: Occupancy Detected"); + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected"); // Reset the timer when the room is occupied RoomVacancyShutdownTimer.Cancel(); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/RoomCues.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/RoomCues.cs deleted file mode 100644 index 0d439d09..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/RoomCues.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials -{ - public static class RoomCue - { - // Commands/ - //bools - public static readonly Cue RoomOnToggle = Cue.BoolCue("RoomOnToggle", 2001); - public static readonly Cue RoomOn = Cue.BoolCue("RoomOn", 2002); - public static readonly Cue RoomOff = Cue.BoolCue("RoomOff", 2003); - public static readonly Cue VolumeUp = Cue.BoolCue("VolumeUp", 2011); - public static readonly Cue VolumeDown = Cue.BoolCue("VolumeDown", 2012); - public static readonly Cue VolumeDefault = Cue.BoolCue("VolumeDefault", 2013); - public static readonly Cue MuteToggle = Cue.BoolCue("MuteToggle", 2014); - public static readonly Cue MuteOn = Cue.BoolCue("MuteOn", 2015); - public static readonly Cue MuteOff = Cue.BoolCue("MuteOff", 2016); - - //ushorts - public static readonly Cue SelectSourceByNumber = Cue.UShortCue("SelectSourceByNumber", 2001); - public static readonly Cue VolumeLevel = Cue.UShortCue("VolumeLevel", 2011); - public static readonly Cue VolumeLevelPercent = Cue.UShortCue("VolumeLevelPercent", 2012); - - //strings - public static readonly Cue SelectSourceByKey = Cue.StringCue("SelectSourceByKey", 2001); - - // Outputs - //Bools - public static readonly Cue RoomIsOn = Cue.BoolCue("RoomIsOn", 2002); - public static readonly Cue RoomIsOnStandby = Cue.BoolCue("RoomIsOnStandby", 2003); - public static readonly Cue RoomIsWarmingUp = Cue.BoolCue("RoomIsWarmingUp", 2004); - public static readonly Cue RoomIsCoolingDown = Cue.BoolCue("RoomIsCoolingDown", 2005); - public static readonly Cue RoomIsOccupied = Cue.BoolCue("RoomIsOccupied", 2006); - - //Ushorts - public static readonly Cue SourcesCount = Cue.UShortCue("SourcesCount", 2001); - public static readonly Cue CurrentSourceNumber = Cue.UShortCue("CurrentSourceNumber", 2002); - public static readonly Cue CurrentSourceType = Cue.UShortCue("CurrentSourceType", 2003); - - //Strings - public static readonly Cue CurrentSourceKey = Cue.StringCue("CurrentSourceKey", 2001); - public static readonly Cue CurrentSourceName = Cue.StringCue("CurrentSourceName", 2002); - - public static readonly Cue VolumeLevelText = Cue.StringCue("VolumeLevelText", 2012); - - public static readonly Cue Key = Cue.StringCue("RoomKey", 2021); - public static readonly Cue Name = Cue.StringCue("RoomName", 2022); - public static readonly Cue Description = Cue.StringCue("Description", 2023); - public static readonly Cue HelpMessage = Cue.StringCue("HelpMessage", 2024); - - //Special - public static readonly Cue Source = new Cue("Source", 0, eCueType.Other); - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectHelper.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectHelper.cs deleted file mode 100644 index f30d8da1..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectHelper.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; - - -namespace PepperDash.Essentials.Core -{ - public class SmartObjectHelper - { - public static uint GetSmartObjectJoinForTypeAndObject(uint sourceType, uint typeOffset) - { - return (uint)(10000 + (sourceType * 100) + typeOffset); - } - - //public static void DumpSmartObject(SmartGraphicsTouchpanelControllerBase tp, uint id) - //{ - // if (!tp.TriList.SmartObjects.Contains(id)) - // { - // Debug.Console(0, tp, "does not contain smart object ID {0}", id); - // return; - // } - // var so = tp.TriList.SmartObjects[id]; - // Debug.Console(0, tp, "Signals for smart object ID {0}", id); - // Debug.Console(0, "BooleanInput -------------------------------"); - // foreach (var s in so.BooleanInput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - // Debug.Console(0, "UShortInput -------------------------------"); - // foreach (var s in so.UShortInput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - // Debug.Console(0, "StringInput -------------------------------"); - // foreach (var s in so.StringInput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - // Debug.Console(0, "BooleanOutput -------------------------------"); - // foreach (var s in so.BooleanOutput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - // Debug.Console(0, "UShortOutput -------------------------------"); - // foreach (var s in so.UShortOutput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - // Debug.Console(0, "StringOutput -------------------------------"); - // foreach (var s in so.StringOutput) - // Debug.Console(0, " {0,5} {1}", s.Number, s.Name); - //} - - ///// - ///// Inserts/removes the appropriate UO's onto sigs - ///// - ///// - ///// - ///// - ///// - //public static void LinkNumpadWithUserObjects(BasicTriListWithSmartObject triList, - // uint smartObjectId, List deviceUserObjects, Cue Misc_1Function, Cue Misc_2Function, bool state) - //{ - // var sigDict = new Dictionary - // { - // { "0", CommonBoolCue.Digit0 }, - // { "1", CommonBoolCue.Digit1 }, - // { "2", CommonBoolCue.Digit2 }, - // { "3", CommonBoolCue.Digit3 }, - // { "4", CommonBoolCue.Digit4 }, - // { "5", CommonBoolCue.Digit5 }, - // { "6", CommonBoolCue.Digit6 }, - // { "7", CommonBoolCue.Digit7 }, - // { "8", CommonBoolCue.Digit8 }, - // { "9", CommonBoolCue.Digit9 }, - // { "Misc_1", Misc_1Function }, - // { "Misc_2", Misc_2Function }, - // }; - // LinkSmartObjectWithUserObjects(triList, smartObjectId, deviceUserObjects, sigDict, state); - //} - - //public static void LinkDpadWithUserObjects(BasicTriListWithSmartObject triList, - // uint smartObjectId, List deviceUserObjects, bool state) - //{ - // var sigDict = new Dictionary - // { - // { "Up", CommonBoolCue.Up }, - // { "Down", CommonBoolCue.Down }, - // { "Left", CommonBoolCue.Left }, - // { "Right", CommonBoolCue.Right }, - // { "OK", CommonBoolCue.Select }, - // }; - // LinkSmartObjectWithUserObjects(triList, smartObjectId, deviceUserObjects, sigDict, state); - //} - - - ///// - ///// MOVE TO HELPER CLASS - ///// - ///// - ///// - ///// - ///// - ///// - //public static void LinkSmartObjectWithUserObjects(BasicTriListWithSmartObject triList, - // uint smartObjectId, List deviceUserObjects, Dictionary smartObjectSigMap, bool state) - //{ - // // Hook up smart objects if applicable - // if (triList.SmartObjects.Contains(smartObjectId)) - // { - // var smartObject = triList.SmartObjects[smartObjectId]; - // foreach (var kvp in smartObjectSigMap) - // { - // if (smartObject.BooleanOutput.Contains(kvp.Key)) - // { - // if (state) - // { - // // look for a user object and if so, attach/detach it to/from the sig. - // var uo = deviceUserObjects.FirstOrDefault(ao => ao.Cue == kvp.Value); - // if (uo != null) - // smartObject.BooleanOutput[kvp.Key].UserObject = uo; - // } - // else - // smartObject.BooleanOutput[kvp.Key].UserObject = null; - // } - // else - // Debug.Console(0, "Smart object {0} does not contain Sig {1}", smartObject.ID, kvp.Key); - // } - // } - // else - // Debug.Console(0, "ERROR Smart object {0} not found on {1:X2}", smartObjectId, triList.ID); - //} - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs index a8da97e4..4878a206 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs @@ -23,6 +23,10 @@ namespace PepperDash.Essentials.Core public StringFeedback TimeRemainingFeedback { get; private set; } public bool CountsDown { get; set; } + + /// + /// The number of seconds to countdown + /// public int SecondsToCount { get; set; } public DateTime StartTime { get; private set; } @@ -31,7 +35,7 @@ namespace PepperDash.Essentials.Core CTimer SecondTimer; /// - /// + /// Constructor /// /// public SecondsCountdownTimer(string key) @@ -61,7 +65,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Starts the Timer /// public void Start() { @@ -82,7 +86,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Restarts the timer /// public void Reset() { @@ -91,7 +95,7 @@ namespace PepperDash.Essentials.Core } /// - /// + /// Cancels the timer (without triggering it to finish) /// public void Cancel() { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED LargeTouchpanelControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED LargeTouchpanelControllerBase.cs deleted file mode 100644 index 97c937b3..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED LargeTouchpanelControllerBase.cs +++ /dev/null @@ -1,275 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; - -//using PepperDash.Core; - - -//namespace PepperDash.Essentials.Core -//{ -// /// -// /// -// /// -// public class LargeTouchpanelControllerBase : SmartGraphicsTouchpanelControllerBase -// { -// public string PresentationShareButtonInVideoText = "Share"; -// public string PresentationShareButtonNotInVideoText = "Presentation"; - -// SourceListSubpageReferenceList SourceSelectSRL; -// DevicePageControllerBase CurrentPresentationSourcePageController; - -// public LargeTouchpanelControllerBase(string key, string name, -// BasicTriListWithSmartObject triList, string sgdFilePath) -// : base(key, name, triList, sgdFilePath) -// { -// } - -// public override bool CustomActivate() -// { -// var baseSuccess = base.CustomActivate(); -// if (!baseSuccess) return false; - -// SourceSelectSRL = new SourceListSubpageReferenceList(this.TriList, n => -// { if (CurrentRoom != null) CurrentRoom.SelectSource(n); }); - -// var lm = Global.LicenseManager; -// if (lm != null) -// { -// lm.LicenseIsValid.LinkInputSig(TriList.BooleanInput[UiCue.ShowLicensed.Number]); -// //others -// } - -// // Temp things ----------------------------------------------------------------------- -// TriList.StringInput[UiCue.SplashMessage.Number].StringValue = SplashMessage; -// //------------------------------------------------------------------------------------ - -// // Initialize initial view -// ShowSplashOrMain(); -// return true; -// } - -// /// -// /// In Essentials, this should NEVER be called, since it's a one-room solution -// /// -// protected override void HideRoomUI() -// { -// // UI Cleanup here???? - -// //SwapAudioDeviceControls(CurrentRoom.CurrentAudioDevice, null); -// //CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange; - -// CurrentRoom.IsCoolingDown.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUp.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange; - -// SourceSelectSRL.DetachFromCurrentRoom(); -// } - -// /// -// /// Ties this panel controller to the Room and gets updates. -// /// -// protected override void ShowRoomUI() -// { -// Debug.Console(1, this, "connecting to system '{0}'", CurrentRoom.Key); - -// TriList.StringInput[RoomCue.Name.Number].StringValue = CurrentRoom.Name; -// TriList.StringInput[RoomCue.Description.Number].StringValue = CurrentRoom.Description; - -// CurrentRoom.IsCoolingDown.OutputChange -= CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUp.OutputChange -= CurrentRoom_IsWarmingUp_OutputChange; -// CurrentRoom.IsCoolingDown.OutputChange += CurrentRoom_IsCoolingDown_OutputChange; -// CurrentRoom.IsWarmingUp.OutputChange += CurrentRoom_IsWarmingUp_OutputChange; - -// SourceSelectSRL.AttachToRoom(CurrentRoom); -// } - -// void CurrentRoom_IsCoolingDown_OutputChange(object sender, EventArgs e) -// { -// Debug.Console(2, this, "Received room in cooldown={0}", CurrentRoom.IsCoolingDown.BoolValue); -// if (CurrentRoom.IsCoolingDown.BoolValue) // When entering cooldown -// { -// // Do we need to check for an already-running cooldown - like in the case of room switches? -// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power Off", "Power", "Please wait, shutting down", -// "", "", CurrentRoom.CooldownTime, true, b => -// { -// ShowSplashOrMain(); -// }); -// } -// } - -// void CurrentRoom_IsWarmingUp_OutputChange(object sender, EventArgs e) -// { -// Debug.Console(2, this, "Received room in warmup={0}", CurrentRoom.IsWarmingUp.BoolValue); -// if (CurrentRoom.IsWarmingUp.BoolValue) // When entering warmup -// { -// // Do we need to check for an already-running cooldown - like in the case of room switches? -// new ModalDialog(TriList).PresentModalTimerDialog(0, "Power On", "Power", "Please wait, powering on", -// "", "", CurrentRoom.WarmupTime, false, b => -// { -// // Reveal sources - or has already been done behind modal -// }); -// } -// } - -// // Handler for source change events. -// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args) -// { -// // Put away the old source and set up the new source. -// Debug.Console(2, this, "Received source change={0}", args.NewSource != null ? args.NewSource.Key : "none"); - -// // If we're in tech, don't switch screen modes. Add any other modes we may want to switch away from -// // inside the if below. -// if (MainMode == eMainModeType.Splash) -// setMainMode(eMainModeType.Presentation); -// SetControlSource(args.NewSource); -// } - -// //*********************************************************************** -// //** UI Manipulation -// //*********************************************************************** - -// /// -// /// Shows the splash page or the main presentation page, depending on config setting -// /// -// void ShowSplashOrMain() -// { -// if (UsesSplashPage) -// setMainMode(eMainModeType.Splash); -// else -// setMainMode(eMainModeType.Presentation); -// } - -// /// -// /// Switches between main modes -// /// -// void setMainMode(eMainModeType mode) -// { -// MainMode = mode; -// switch (mode) -// { -// case eMainModeType.Presentation: -// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = true; -// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = true; -// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = true; -// ShowCurrentPresentationSourceUi(); -// break; -// case eMainModeType.Splash: -// TriList.BooleanInput[UiCue.VisibleCommonFooter.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisibleCommonHeader.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisiblePresentationSourceList.Number].BoolValue = false; -// TriList.BooleanInput[UiCue.VisibleSplash.Number].BoolValue = true; -// HideCurrentPresentationSourceUi(); -// break; -// case eMainModeType.Tech: -// new ModalDialog(TriList).PresentModalTimerDialog(1, "Tech page", "Info", -// "Tech page will be here soon!
I promise", -// "Bueno!", "", 0, false, null); -// MainMode = eMainModeType.Presentation; -// break; -// default: -// break; -// } -// } - -// void PowerOffWithConfirmPressed() -// { -// if (!CurrentRoom.RoomIsOn.BoolValue) return; -// // Timeout or button 1 press will shut down -// var modal = new ModalDialog(TriList); -// uint seconds = CurrentRoom.UnattendedShutdownTimeMs / 1000; -// var message = string.Format("Meeting will end in {0} seconds", seconds); -// modal.PresentModalTimerDialog(2, "End Meeting", "Info", message, -// "End Meeting Now", "Cancel", CurrentRoom.UnattendedShutdownTimeMs, true, -// but => { if (but != 2) CurrentRoom.RoomOff(); }); -// } - -// /// -// /// Reveals the basic UI for the current device -// /// -// protected override void ShowCurrentPresentationSourceUi() -// { -// if (MainMode == eMainModeType.Splash && CurrentRoom.RoomIsOn.BoolValue) -// setMainMode(eMainModeType.Presentation); - -// if (CurrentPresentationControlDevice == null) -// { -// // If system is off, do one thing - -// // Otherwise, do something else - shouldn't be in this condition - -// return; -// } - -// // If a controller is already loaded, use it -// if (LoadedPageControllers.ContainsKey(CurrentPresentationControlDevice)) -// CurrentPresentationSourcePageController = LoadedPageControllers[CurrentPresentationControlDevice]; -// else -// { -// // This is by no means optimal, but for now.... -// if (CurrentPresentationControlDevice.Type == PresentationSourceType.SetTopBox -// && CurrentPresentationControlDevice is IHasSetTopBoxProperties) -// CurrentPresentationSourcePageController = new PageControllerLargeSetTopBoxGeneric(TriList, -// CurrentPresentationControlDevice as IHasSetTopBoxProperties); - -// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Laptop) -// CurrentPresentationSourcePageController = new PageControllerLaptop(TriList); - -// // separate these... -// else if (CurrentPresentationControlDevice.Type == PresentationSourceType.Dvd) -// CurrentPresentationSourcePageController = -// new PageControllerLargeDvd(TriList, CurrentPresentationControlDevice as IHasCueActionList); - -// else -// CurrentPresentationSourcePageController = null; - -// // Save it. -// if (CurrentPresentationSourcePageController != null) -// LoadedPageControllers[CurrentPresentationControlDevice] = CurrentPresentationSourcePageController; -// } - -// if (CurrentPresentationSourcePageController != null) -// CurrentPresentationSourcePageController.SetVisible(true); -// } - -// protected override void HideCurrentPresentationSourceUi() -// { -// if (CurrentPresentationControlDevice != null && CurrentPresentationSourcePageController != null) -// CurrentPresentationSourcePageController.SetVisible(false); -// } - - - -// void ShowHelp() -// { -// new ModalDialog(TriList).PresentModalTimerDialog(1, "Help", "Help", CurrentRoom.HelpMessage, -// "OK", "", 0, false, null); -// } - -// protected void ListSmartObjects() -// { -// Debug.Console(0, this, "Smart objects IDs:"); -// var list = TriList.SmartObjects.OrderBy(s => s.Key); -// foreach (var kvp in list) -// Debug.Console(0, " {0}", kvp.Key); -// } - -// public override List FunctionList -// { -// get -// { -// return new List -// { -// new BoolCueActionPair(UiCue.PressSplash, b => { if(!b) setMainMode(eMainModeType.Presentation); }), -// new BoolCueActionPair(UiCue.PressRoomOffWithConfirm, b => { if(!b) PowerOffWithConfirmPressed(); }), -// new BoolCueActionPair(UiCue.PressModePresentationShare, b => { if(!b) setMainMode(eMainModeType.Presentation); }), -// new BoolCueActionPair(UiCue.PressHelp, b => { if(!b) ShowHelp(); }), -// new BoolCueActionPair(UiCue.PressSettings, b => { if(!b) setMainMode(eMainModeType.Tech); }), -// }; -// } -// } -// //#endregion -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED UIControllers/DevicePageControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED UIControllers/DevicePageControllerBase.cs deleted file mode 100644 index 334050e0..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/MOVED UIControllers/DevicePageControllerBase.cs +++ /dev/null @@ -1,244 +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.Essentials.Core.Presets; - -//using PepperDash.Core; - - -//namespace PepperDash.Essentials.Core -//{ -// /// -// /// -// /// -// public abstract class DevicePageControllerBase -// { - -// protected BasicTriListWithSmartObject TriList; -// protected List FixedObjectSigs; - -// public DevicePageControllerBase(BasicTriListWithSmartObject triList) -// { -// TriList = triList; -// } - -// public void SetVisible(bool state) -// { -// foreach (var sig in FixedObjectSigs) -// { -// Debug.Console(2, "set visible {0}={1}", sig.Number, state); -// sig.BoolValue = state; -// } -// CustomSetVisible(state); -// } - -// /// -// /// Add any specialized show/hide logic here - beyond FixedObjectSigs. Overriding -// /// methods do not need to call this base method -// /// -// protected virtual void CustomSetVisible(bool state) -// { -// } -// } - -// //public class InterlockedDevicePageController -// //{ -// // public List ObjectBoolJoins { get; set; } -// // public uint DefaultJoin { get; set; } -// //} - - - - -// ///// -// ///// -// ///// -// //public interface IHasSetTopBoxProperties -// //{ -// // bool HasDpad { get; } -// // bool HasPreset { get; } -// // bool HasDvr { get; } -// // bool HasNumbers { get; } -// // DevicePresetsModel PresetsModel { get; } -// // void LoadPresets(string filePath); -// //} - -// public class PageControllerLaptop : DevicePageControllerBase -// { -// public PageControllerLaptop(BasicTriListWithSmartObject tl) -// : base(tl) -// { -// FixedObjectSigs = new List -// { -// tl.BooleanInput[10092], // well -// tl.BooleanInput[11001] // Laptop info -// }; -// } -// } - -// ///// -// ///// -// ///// -// //public class PageControllerLargeDvd : DevicePageControllerBase -// //{ -// // IHasCueActionList Device; - -// // public PageControllerLargeDvd(BasicTriListWithSmartObject tl, IHasCueActionList device) -// // : base(tl) -// // { - -// // Device = device; -// // FixedObjectSigs = new List -// // { -// // tl.BooleanInput[10093], // well -// // tl.BooleanInput[10411], // DVD Dpad -// // tl.BooleanInput[10412] // everything else -// // }; -// // } - -// // protected override void CustomSetVisible(bool state) -// // { -// // // Hook up smart objects if applicable -// // if (Device != null) -// // { -// // var uos = (Device as IHasCueActionList).CueActionList; -// // SmartObjectHelper.LinkDpadWithUserObjects(TriList, 10411, uos, state); -// // } -// // } -// //} - - -// /// -// /// -// /// -// //public class PageControllerLargeSetTopBoxGeneric : DevicePageControllerBase -// //{ -// // // To-DO: Add properties for component subpage names. DpadPos1, DpadPos2... -// // // Derived classes can then insert special subpages for variations on given -// // // device types. Like DirecTV vs Comcast - -// // public uint DpadSmartObjectId { get; set; } -// // public uint NumberPadSmartObjectId { get; set; } -// // public uint PresetsSmartObjectId { get; set; } -// // public uint Position5TabsId { get; set; } - -// // IHasSetTopBoxProperties Device; -// // DevicePresetsView PresetsView; - - -// // bool ShowPosition5Tabs; -// // uint CurrentVisiblePosition5Item = 1; -// // Dictionary Position5SubpageJoins = new Dictionary -// // { -// // { 1, 10053 }, -// // { 2, 10054 } -// // }; - -// // public PageControllerLargeSetTopBoxGeneric(BasicTriListWithSmartObject tl, IHasSetTopBoxProperties device) -// // : base(tl) -// // { -// // Device = device; -// // DpadSmartObjectId = 10011; -// // NumberPadSmartObjectId = 10014; -// // PresetsSmartObjectId = 10012; -// // Position5TabsId = 10081; - -// // bool dpad = device.HasDpad; -// // bool preset = device.HasPreset; -// // bool dvr = device.HasDvr; -// // bool numbers = device.HasNumbers; -// // uint[] joins = null; - -// // if (dpad && !preset && !dvr && !numbers) joins = new uint[] { 10031, 10091 }; -// // else if (!dpad && preset && !dvr && !numbers) joins = new uint[] { 10032, 10091 }; -// // else if (!dpad && !preset && dvr && !numbers) joins = new uint[] { 10033, 10091 }; -// // else if (!dpad && !preset && !dvr && numbers) joins = new uint[] { 10034, 10091 }; - -// // else if (dpad && preset && !dvr && !numbers) joins = new uint[] { 10042, 10021, 10092 }; -// // else if (dpad && !preset && dvr && !numbers) joins = new uint[] { 10043, 10021, 10092 }; -// // else if (dpad && !preset && !dvr && numbers) joins = new uint[] { 10044, 10021, 10092 }; -// // else if (!dpad && preset && dvr && !numbers) joins = new uint[] { 10043, 10022, 10092 }; -// // else if (!dpad && preset && !dvr && numbers) joins = new uint[] { 10044, 10022, 10092 }; -// // else if (!dpad && !preset && dvr && numbers) joins = new uint[] { 10044, 10023, 10092 }; - -// // else if (dpad && preset && dvr && !numbers) joins = new uint[] { 10053, 10032, 10011, 10093 }; -// // else if (dpad && preset && !dvr && numbers) joins = new uint[] { 10054, 10032, 10011, 10093 }; -// // else if (dpad && !preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10011, 10093 }; -// // else if (!dpad && preset && dvr && numbers) joins = new uint[] { 10054, 10033, 10012, 10093 }; - -// // else if (dpad && preset && dvr && numbers) -// // { -// // joins = new uint[] { 10081, 10032, 10011, 10093 }; // special case -// // ShowPosition5Tabs = true; -// // } -// // // Project the joins into corresponding sigs. -// // FixedObjectSigs = joins.Select(u => TriList.BooleanInput[u]).ToList(); - -// // // Build presets -// // if (device.HasPreset) -// // { -// // PresetsView = new DevicePresetsView(tl, device.PresetsModel); -// // } - - -// // } - -// // protected override void CustomSetVisible(bool state) -// // { -// // if (ShowPosition5Tabs) -// // { -// // // Show selected tab -// // TriList.BooleanInput[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = state; - -// // var tabSo = TriList.SmartObjects[Position5TabsId]; -// // if (state) // Link up the tab object - -// // { -// // tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = new BoolCueActionPair(b => ShowTab(1)); -// // tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = new BoolCueActionPair(b => ShowTab(2)); -// // } -// // else // Disco tab object -// // { -// // tabSo.BooleanOutput["Tab Button 1 Press"].UserObject = null; -// // tabSo.BooleanOutput["Tab Button 2 Press"].UserObject = null; -// // } -// // } - -// // // Hook up smart objects if applicable -// // if (Device is IHasCueActionList) -// // { -// // var uos = (Device as IHasCueActionList).CueActionList; -// // SmartObjectHelper.LinkDpadWithUserObjects(TriList, DpadSmartObjectId, uos, state); -// // SmartObjectHelper.LinkNumpadWithUserObjects(TriList, NumberPadSmartObjectId, -// // uos, CommonBoolCue.Dash, CommonBoolCue.Last, state); -// // } - - -// // // Link, unlink presets -// // if (Device.HasPreset && state) -// // PresetsView.Attach(); -// // else if (Device.HasPreset && !state) -// // PresetsView.Detach(); -// // } - -// // void ShowTab(uint number) -// // { -// // // Ignore re-presses -// // if (CurrentVisiblePosition5Item == number) return; -// // // Swap subpage -// // var bi = TriList.BooleanInput; -// // if(CurrentVisiblePosition5Item > 0) -// // bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = false; -// // CurrentVisiblePosition5Item = number; -// // bi[Position5SubpageJoins[CurrentVisiblePosition5Item]].BoolValue = true; - -// // // Show feedback on buttons -// // } - -// //} -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/REMOVE Tsr302Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/REMOVE Tsr302Controller.cs deleted file mode 100644 index 13cfabcc..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/REMOVE Tsr302Controller.cs +++ /dev/null @@ -1,135 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -//using Crestron.SimplSharpPro.UI; - -//using PepperDash.Core; - - -//namespace PepperDash.Essentials.Core -//{ -//[Obsolete("Replaced, initially with CrestronTsr302Controller in Resissentials")] -// public class Tsr302Controller : SmartGraphicsTouchpanelControllerBase -// { -// //public override List FunctionList -// //{ -// // get -// // { -// // return new List -// // { - -// // }; -// // } -// //} - -// public Tsr302 Remote { get; private set; } - -// SourceListSubpageReferenceList SourceSelectSRL; -// DevicePageControllerBase CurrentPresentationSourcePageController; -// CTimer VolumeFeedbackTimer; - - -// public Tsr302Controller(string key, string name, Tsr302 device, string sgdFilePath) : -// base(key, name, device, sgdFilePath) -// { -// // Base takes care of TriList -// Remote = device; -// Remote.Home.UserObject = new BoolCueActionPair(b => { if (!b) PressHome(); }); -// Remote.VolumeUp.UserObject = new BoolCueActionPair(b => { if (!b) PressHome(); }); -// Remote.ButtonStateChange += Remote_ButtonStateChange; -// } - -// public override bool CustomActivate() -// { -// var baseSuccess = base.CustomActivate(); -// if (!baseSuccess) return false; - -// SourceSelectSRL = new SourceListSubpageReferenceList(this.TriList, n => -// { if (CurrentRoom != null) CurrentRoom.SelectSource(n); }); - - -// return true; -// } - -// protected override void SwapAudioDeviceControls(IVolumeFunctions oldDev, IVolumeFunctions newDev) -// { -// // stop presses -// if (oldDev != null) -// { -// ReleaseAudioPresses(); -// if (oldDev is IVolumeTwoWay) -// { -// (newDev as IVolumeTwoWay).VolumeLevelFeedback.OutputChange -= VolumeLevelOutput_OutputChange; -// (oldDev as IVolumeTwoWay).VolumeLevelFeedback -// .UnlinkInputSig(TriList.UShortInput[CommonIntCue.MainVolumeLevel.Number]); -// } -// } - -// if (newDev != null) -// { -// Remote.VolumeDown.UserObject = newDev.VolumeDownCueActionPair; -// Remote.VolumeUp.UserObject = newDev.VolumeUpCueActionPair; -// Remote.Mute.UserObject = newDev.MuteToggleCueActionPair; -// if (newDev is IVolumeTwoWay) -// { -// var vOut = (newDev as IVolumeTwoWay).VolumeLevelFeedback; -// vOut.OutputChange += VolumeLevelOutput_OutputChange; -// TriList.UShortInput[CommonIntCue.MainVolumeLevel.Number].UShortValue = vOut.UShortValue; -// } -// } -// else -// { -// Remote.VolumeDown.UserObject = null; -// Remote.VolumeUp.UserObject = null; -// Remote.Mute.UserObject = null; -// } - -// base.SwapAudioDeviceControls(oldDev, newDev); -// } - -// void PressHome() -// { - -// } - -// void VolumeLevelOutput_OutputChange(object sender, EventArgs e) -// { -// // Set level and show popup on timer -// TriList.UShortInput[CommonIntCue.MainVolumeLevel.Number].UShortValue = -// (sender as IntFeedback).UShortValue; - -// if (VolumeFeedbackTimer == null) -// { -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true; -// VolumeFeedbackTimer = new CTimer(o => { -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = false; -// }, 1000); -// } - -// } - -// void ReleaseAudioPresses() -// { -// if (Remote.VolumeDown.UserObject is BoolCueActionPair && Remote.VolumeDown.State == eButtonState.Pressed) -// (Remote.VolumeDown.UserObject as BoolCueActionPair).Invoke(false); -// if (Remote.VolumeUp.UserObject is BoolCueActionPair && Remote.VolumeUp.State == eButtonState.Pressed) -// (Remote.VolumeUp.UserObject as BoolCueActionPair).Invoke(false); -// if (Remote.Mute.UserObject is BoolCueActionPair && Remote.Mute.State == eButtonState.Pressed) -// (Remote.Mute.UserObject as BoolCueActionPair).Invoke(false); -// } - -// /// -// /// Handler. Run UO's stored in buttons -// /// -// void Remote_ButtonStateChange(GenericBase device, ButtonEventArgs args) -// { -// Debug.Console(2, this, "{0}={1}", args.Button.Name, args.Button.State); -// var uo = args.Button.UserObject as BoolCueActionPair; -// if (uo != null) -// uo.Invoke(args.NewButtonState == eButtonState.Pressed); -// } -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/SmartGraphicsTouchpanelControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/SmartGraphicsTouchpanelControllerBase.cs deleted file mode 100644 index 42c365d1..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Touchpanels/SmartGraphicsTouchpanelControllerBase.cs +++ /dev/null @@ -1,309 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; - - -//namespace PepperDash.Essentials.Core -//{ -// public abstract class SmartGraphicsTouchpanelControllerBase : CrestronGenericBaseDevice -// { -// public BasicTriListWithSmartObject TriList { get; protected set; } -// public bool UsesSplashPage { get; set; } -// public string SplashMessage { get; set; } -// public bool ShowDate -// { -// set { TriList.BooleanInput[UiCue.ShowDate.Number].BoolValue = value; } -// } -// public bool ShowTime -// { -// set { TriList.BooleanInput[UiCue.ShowTime.Number].BoolValue = value; } -// } - -// public abstract List FunctionList { get; } - - -// protected eMainModeType MainMode; -// protected IPresentationSource CurrentPresentationControlDevice; - -// /// -// /// Defines the signal offset for the presentation device. Defaults to 100 -// /// -// public uint PresentationControlDeviceJoinOffset { get { return 100; } } - -// public enum eMainModeType -// { -// Presentation, Splash, Tech -// } - -// protected string SgdFilePath; -// public EssentialsRoom CurrentRoom { get; protected set; } -// protected Dictionary LoadedPageControllers -// = new Dictionary(); - -// static object RoomChangeLock = new object(); - -// /// -// /// Constructor -// /// -// public SmartGraphicsTouchpanelControllerBase(string key, string name, BasicTriListWithSmartObject triList, -// string sgdFilePath) -// : base(key, name, triList) -// { -// TriList = triList; -// if (string.IsNullOrEmpty(key)) throw new ArgumentNullException("key"); -// if (string.IsNullOrEmpty(sgdFilePath)) throw new ArgumentNullException("sgdFilePath"); -// SgdFilePath = sgdFilePath; -// TriList.LoadSmartObjects(SgdFilePath); -// UsesSplashPage = true; -// SplashMessage = "Welcome"; -// TriList.SigChange += Tsw_AnySigChange; -// foreach (var kvp in TriList.SmartObjects) -// kvp.Value.SigChange += this.Tsw_AnySigChange; -// } - -// public override bool CustomActivate() -// { -// var baseSuccess = base.CustomActivate(); -// if (!baseSuccess) return false; - -// // Wiring up the buttons with UOs -// foreach (var uo in this.FunctionList) -// { -// if (uo.Cue.Number == 0) continue; -// if (uo is BoolCueActionPair) -// TriList.BooleanOutput[uo.Cue.Number].UserObject = uo; -// else if (uo is UShortCueActionPair) -// TriList.UShortOutput[uo.Cue.Number].UserObject = uo; -// else if (uo is StringCueActionPair) -// TriList.StringOutput[uo.Cue.Number].UserObject = uo; -// } - -// return true; -// } - -// //public void SetCurrentRoom(EssentialsRoom room) -// //{ -// // if (CurrentRoom != null) -// // HideRoomUI(); -// // CurrentRoom = room; -// // ShowRoomUI(); -// //} - -// /// -// /// -// /// -// /// -// public void SetCurrentRoom(EssentialsRoom room) -// { -// if (CurrentRoom == room) return; - -// IVolumeFunctions oldAudio = null; -// //Disconnect current room and audio device -// if (CurrentRoom != null) -// { -// HideRoomUI(); -// CurrentRoom.AudioDeviceWillChange -= CurrentRoom_AudioDeviceWillChange; -// CurrentRoom.PresentationSourceChange -= CurrentRoom_PresentationSourceChange; -// oldAudio = CurrentRoom.CurrentAudioDevice; -// } - -// CurrentRoom = room; -// IVolumeFunctions newAudio = null; -// if (CurrentRoom != null) -// { -// CurrentRoom.AudioDeviceWillChange += this.CurrentRoom_AudioDeviceWillChange; -// CurrentRoom.PresentationSourceChange += this.CurrentRoom_PresentationSourceChange; -// SetControlSource(CurrentRoom.CurrentPresentationSource); -// newAudio = CurrentRoom.CurrentAudioDevice; -// ShowRoomUI(); -// } - -// SwapAudioDeviceControls(oldAudio, newAudio); -// } - -// /// -// /// Detaches and attaches an IVolumeFunctions device to the appropriate TP TriList signals. -// /// This will also add IVolumeNumeric if the device implements it. -// /// Overriding classes should call this. Overriding classes are responsible for -// /// linking up to hard keys, etc. -// /// -// /// May be null -// /// May be null -// protected virtual void SwapAudioDeviceControls(IVolumeFunctions oldDev, IVolumeFunctions newDev) -// { -// // Disconnect -// if (oldDev != null) -// { -// TriList.BooleanOutput[CommonBoolCue.VolumeDown.Number].UserObject = null; -// TriList.BooleanOutput[CommonBoolCue.VolumeUp.Number].UserObject = null; -// TriList.BooleanOutput[CommonBoolCue.MuteToggle.Number].UserObject = null; -// TriList.BooleanInput[CommonBoolCue.ShowVolumeButtons.Number].BoolValue = false; -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = false; -// if (oldDev is IVolumeTwoWay) -// { -// TriList.UShortOutput[CommonIntCue.MainVolumeLevel.Number].UserObject = null; -// (oldDev as IVolumeTwoWay).IsMutedFeedback -// .UnlinkInputSig(TriList.BooleanInput[CommonBoolCue.MuteOn.Number]); -// (oldDev as IVolumeTwoWay).VolumeLevelFeedback -// .UnlinkInputSig(TriList.UShortInput[CommonIntCue.MainVolumeLevel.Number]); -// } -// } -// if (newDev != null) -// { -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true; -// TriList.BooleanOutput[CommonBoolCue.VolumeDown.Number].UserObject = newDev.VolumeDownCueActionPair; -// TriList.BooleanOutput[CommonBoolCue.VolumeUp.Number].UserObject = newDev.VolumeUpCueActionPair; -// TriList.BooleanOutput[CommonBoolCue.MuteToggle.Number].UserObject = newDev.MuteToggleCueActionPair; -// if (newDev is IVolumeTwoWay) -// { -// TriList.BooleanInput[CommonBoolCue.ShowVolumeSlider.Number].BoolValue = true; -// var numDev = newDev as IVolumeTwoWay; -// TriList.UShortOutput[CommonIntCue.MainVolumeLevel.Number].UserObject = numDev.VolumeLevelCueActionPair; -// numDev.VolumeLevelFeedback -// .LinkInputSig(TriList.UShortInput[CommonIntCue.MainVolumeLevel.Number]); -// } -// } -// } - - -// /// -// /// Does nothing. Override to add functionality when calling SetCurrentRoom -// /// -// protected virtual void HideRoomUI() { } - -// /// -// /// Does nothing. Override to add functionality when calling SetCurrentRoom -// /// -// protected virtual void ShowRoomUI() { } - -// /// -// /// Sets up the current presentation device and updates statuses if the device is capable. -// /// -// protected void SetControlSource(IPresentationSource newSource) -// { -// if (CurrentPresentationControlDevice != null) -// { -// HideCurrentPresentationSourceUi(); - -// // Unhook presses and things -// if (CurrentPresentationControlDevice is IHasCueActionList) -// { -// foreach (var uo in (CurrentPresentationControlDevice as IHasCueActionList).CueActionList) -// { -// if (uo.Cue.Number == 0) continue; -// if (uo is BoolCueActionPair) -// { -// var bSig = TriList.BooleanOutput[uo.Cue.Number]; -// // Disconnection should also clear bool sigs in case they are pressed and -// // might be orphaned -// if (bSig.BoolValue) -// (bSig.UserObject as BoolCueActionPair).Invoke(false); -// bSig.UserObject = null; -// } -// else if (uo is UShortCueActionPair) -// TriList.UShortOutput[uo.Cue.Number].UserObject = null; -// else if (uo is StringCueActionPair) -// TriList.StringOutput[uo.Cue.Number].UserObject = null; -// } -// } -// // unhook outputs -// if (CurrentPresentationControlDevice is IHasFeedback) -// { -// foreach (var output in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks) -// { -// if (output.Cue.Number == 0) continue; -// if (output is BoolFeedback) -// (output as BoolFeedback).UnlinkInputSig(TriList.BooleanInput[output.Cue.Number]); -// else if (output is IntFeedback) -// (output as IntFeedback).UnlinkInputSig(TriList.UShortInput[output.Cue.Number]); -// else if (output is StringFeedback) -// (output as StringFeedback).UnlinkInputSig(TriList.StringInput[output.Cue.Number]); -// } -// } -// } -// CurrentPresentationControlDevice = newSource; -// //connect presses and things -// if (newSource is IHasCueActionList) // This has functions, get 'em -// { -// foreach (var ao in (newSource as IHasCueActionList).CueActionList) -// { -// if (ao.Cue.Number == 0) continue; -// if (ao is BoolCueActionPair) -// TriList.BooleanOutput[ao.Cue.Number].UserObject = ao; -// else if (ao is UShortCueActionPair) -// TriList.UShortOutput[ao.Cue.Number].UserObject = ao; -// else if (ao is StringCueActionPair) -// TriList.StringOutput[ao.Cue.Number].UserObject = ao; -// } -// } -// // connect outputs (addInputSig should update sig) -// if (CurrentPresentationControlDevice is IHasFeedback) -// { -// foreach (var output in (CurrentPresentationControlDevice as IHasFeedback).Feedbacks) -// { -// if (output.Cue.Number == 0) continue; -// if (output is BoolFeedback) -// (output as BoolFeedback).LinkInputSig(TriList.BooleanInput[output.Cue.Number]); -// else if (output is IntFeedback) -// (output as IntFeedback).LinkInputSig(TriList.UShortInput[output.Cue.Number]); -// else if (output is StringFeedback) -// (output as StringFeedback).LinkInputSig(TriList.StringInput[output.Cue.Number]); -// } -// } -// ShowCurrentPresentationSourceUi(); -// } - -// /// -// /// Reveals the basic UI for the current device -// /// -// protected virtual void ShowCurrentPresentationSourceUi() -// { -// } - -// /// -// /// Hides the UI for the current device and calls for a feedback signal cleanup -// /// -// protected virtual void HideCurrentPresentationSourceUi() -// { -// } - - -// /// -// /// -// /// -// void CurrentRoom_PresentationSourceChange(object sender, EssentialsRoomSourceChangeEventArgs args) -// { -// SetControlSource(args.NewSource); -// } - - -// /// -// /// -// /// -// void CurrentRoom_AudioDeviceWillChange(object sender, EssentialsRoomAudioDeviceChangeEventArgs e) -// { -// SwapAudioDeviceControls(e.OldDevice, e.NewDevice); -// } - - - -// /// -// /// Panel event handler -// /// -// void Tsw_AnySigChange(object currentDevice, SigEventArgs args) -// { -// // plugged in commands -// object uo = args.Sig.UserObject; - -// if (uo is Action) -// (uo as Action)(args.Sig.BoolValue); -// else if (uo is Action) -// (uo as Action)(args.Sig.UShortValue); -// else if (uo is Action) -// (uo as Action)(args.Sig.StringValue); -// } -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/VideoStatus/VideoStatusCues.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/VideoStatus/VideoStatusCues.cs deleted file mode 100644 index 5db78fb5..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/VideoStatus/VideoStatusCues.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -namespace PepperDash.Essentials.Core -{ - public static class VideoStatusCues - { - public static readonly Cue HasVideoStatusFeedback = Cue.BoolCue("HasVideoStatusFeedback", 1); - public static readonly Cue VideoSyncFeedback = Cue.BoolCue("VideoSyncFeedback", 2); - public static readonly Cue HdcpActiveFeedback = Cue.BoolCue("HdcpActiveFeedback", 3); - public static readonly Cue HdcpStateFeedback = Cue.StringCue("HdcpStateFeedback", 3); - public static readonly Cue VideoResolutionFeedback = Cue.StringCue("VideoResolutionFeedback", 2); - public static readonly Cue VideoStatusDeviceKey = Cue.StringCue("VideoStatusDeviceKey", 0); - public static readonly Cue VideoStatusDeviceName = Cue.StringCue("VideoStatusDeviceName", 4); - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmInputCardBase.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmInputCardBase.cs deleted file mode 100644 index a0c9536c..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmInputCardBase.cs +++ /dev/null @@ -1,62 +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 Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.DM; - -//namespace PepperDash.Essentials.DM.Cards -//{ -// public class DmInputCardControllerBase : IRoutingInputsOutputs -// { -// public string Key { get; private set; } -// public uint Slot { get; private set; } -// public abstract eDmInputCardType Type { get; } - -// //public RoutingOutputPort BackplaneVideoOut { get; private set; } -// //public RoutingOutputPort BackplaneAudioOut { get; private set; } - -// public RoutingPortCollection InputPorts { get; private set; } - -// public RoutingPortCollection OutputPorts { get; private set; } - -// public DmInputCardControllerBase(string key, uint slot) -// { -// Key = key; -// Slot = slot; -// //BackplaneAudioOut = new RoutingOutputPort("backplaneAudioOut", eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.BackplaneOnly, slot, this); -// //BackplaneVideoOut = new RoutingOutputPort("backplaneVideoOut", eRoutingSignalType.Video, -// // eRoutingPortConnectionType.BackplaneOnly, slot, this); -// //InputPorts = new RoutingPortCollection(); -// //OutputPorts = new RoutingPortCollection { BackplaneAudioOut, BackplaneVideoOut }; -// } - -// ///// -// ///// Gets a physical port by name. Returns null if doesn't exist -// ///// -// //public RoutingInputPort GetInputPort(string key) -// //{ -// // return InputPorts.FirstOrDefault(p => p.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); -// //} - -// ///// -// ///// Gets a physical port by name. Returns null if doesn't exist -// ///// -// //public RoutingOutputPort GetOutputPort(string key) -// //{ -// // return OutputPorts.FirstOrDefault(p => p.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); -// //} -// } - -// public enum eDmInputCardType -// { -// None, DmcHd, DmcHdDsp, Dmc4kHd, Dmc4kHdDsp, Dmc4kC, Dmc4kCDsp -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmOutputCardBase.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmOutputCardBase.cs deleted file mode 100644 index c554539a..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmOutputCardBase.cs +++ /dev/null @@ -1,79 +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 Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Cards; - -using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM; - -namespace PepperDash.Essentials.DM.Cards -{ - /// - /// - /// - public abstract class DmSingleOutputCardControllerBase// : IRoutingInputsOutputs - { - public string Key { get; private set; } - public uint Slot { get; private set; } - public abstract eDmOutputCardType Type { get; } - - //public RoutingInputPort BackplaneAudioIn1 { get; private set; } - //public RoutingInputPort BackplaneVideoIn1 { get; private set; } - //public RoutingInputPort BackplaneAudioIn2 { get; private set; } - //public RoutingInputPort BackplaneVideoIn2 { get; private set; } - - //public RoutingPortCollection InputPorts { get; private set; } - //public RoutingPortCollection OutputPorts { get; private set; } - - public DmSingleOutputCardControllerBase(string key, uint cardSlot) - { - Key = key; - Slot = cardSlot; - //BackplaneAudioIn1 = new RoutingInputPort("backplaneAudioIn1", eRoutingSignalType.Audio, - // eRoutingPortConnectionType.BackplaneOnly, cardSlot, this); - //BackplaneVideoIn1 = new RoutingInputPort("backplaneVideoIn1", eRoutingSignalType.Video, - // eRoutingPortConnectionType.BackplaneOnly, cardSlot, this); - //BackplaneAudioIn2 = new RoutingInputPort("backplaneAudioIn2", eRoutingSignalType.Audio, - // eRoutingPortConnectionType.BackplaneOnly, cardSlot + 1, this); - //BackplaneVideoIn2 = new RoutingInputPort("backplaneVideoIn2", eRoutingSignalType.Video, - // eRoutingPortConnectionType.BackplaneOnly, cardSlot + 1, this); - //InputPorts = new RoutingPortCollection - //{ - // BackplaneAudioIn1, - // BackplaneAudioIn2, - // BackplaneVideoIn1, - // BackplaneVideoIn2 - //}; - //OutputPorts = new RoutingPortCollection(); - } - - ///// - ///// Gets a physical port by name. Returns null if doesn't exist - ///// - //public RoutingInputPort GetInputPort(string key) - //{ - // return InputPorts.FirstOrDefault(p => p.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); - //} - - ///// - ///// Gets a physical port by name. Returns null if doesn't exist - ///// - //public RoutingOutputPort GetOutputPort(string key) - //{ - // return OutputPorts.FirstOrDefault(p => p.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); - //} - } - - /// - /// - /// - public enum eDmOutputCardType - { - None, Dmc4kCoHd, Dmc4kHdo, DmcCoHd, DmcSoHd - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kCoHdSingleOutputCard.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kCoHdSingleOutputCard.cs deleted file mode 100644 index 44dc917a..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kCoHdSingleOutputCard.cs +++ /dev/null @@ -1,43 +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 Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Cards; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM; - -namespace PepperDash.Essentials.DM.Cards -{ - public class Dmc4kCoHdSingleOutputCard : DmSingleOutputCardControllerBase - { - public override eDmOutputCardType Type - { - get { return eDmOutputCardType.Dmc4kCoHd; } - } - public Dmc4kCoHdSingle Card { get; private set; } - - //public RoutingOutputPort DmOut1 { get; private set; } - //public RoutingOutputPort DmOut2 { get; private set; } - //public RoutingOutputPort HdmiOut1 { get; private set; } - - public Dmc4kCoHdSingleOutputCard(string key, Dmc4kCoHdSingle card, uint slot) - : base(key, slot) - { - Card = card; - //DmOut1 = new RoutingOutputPort(DmPortName.DmOut1, eRoutingSignalType.Audio | eRoutingSignalType.Video, - // eRoutingPortConnectionType.DmCat, null, this); - //DmOut2 = new RoutingOutputPort(DmPortName.DmOut2, eRoutingSignalType.Audio | eRoutingSignalType.Video, - // eRoutingPortConnectionType.DmCat, null, this); - //HdmiOut1 = new RoutingOutputPort(DmPortName.HdmiOut1, eRoutingSignalType.Audio | eRoutingSignalType.Video, - // eRoutingPortConnectionType.Hdmi, null, this); - - //OutputPorts.AddRange(new[] { DmOut1, DmOut2, HdmiOut1 }); - } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kHdoSingleOutputCard.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kHdoSingleOutputCard.cs deleted file mode 100644 index 2d3e9884..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/Dmc4kHdoSingleOutputCard.cs +++ /dev/null @@ -1,46 +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 Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.DM; - -//namespace PepperDash.Essentials.DM.Cards -//{ -// public class Dmc4kHdoSingleOutputCard : DmSingleOutputCardControllerBase -// { -// public override eDmOutputCardType Type -// { -// get { return eDmOutputCardType.Dmc4kHdo; } -// } -// public Dmc4kHdoSingle Card { get; private set; } - -// //public RoutingOutputPort AudioOut1 { get; private set; } -// //public RoutingOutputPort AudioOut2 { get; private set; } -// //public RoutingOutputPort HdmiOut1 { get; private set; } -// //public RoutingOutputPort HdmiOut2 { get; private set; } - -// public Dmc4kHdoSingleOutputCard(string key, Dmc4kHdoSingle card, uint slot) -// : base(key, slot) -// { -// Card = card; -// //AudioOut1 = new RoutingOutputPort(DmPortName.BalancedAudioOut1, eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.LineAudio, null, this); -// //AudioOut2 = new RoutingOutputPort(DmPortName.BalancedAudioOut2, eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.LineAudio, null, this); -// //HdmiOut1 = new RoutingOutputPort(DmPortName.HdmiOut1, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this); -// //HdmiOut2 = new RoutingOutputPort(DmPortName.HdmiOut2, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this); - -// //OutputPorts.AddRange(new[] { AudioOut1, AudioOut2, HdmiOut1, HdmiOut2 }); -// } -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcC4kInputCard.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcC4kInputCard.cs deleted file mode 100644 index d2ab69e2..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcC4kInputCard.cs +++ /dev/null @@ -1,76 +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 Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.DM; - -//namespace PepperDash.Essentials.DM.Cards -//{ -// public class Dmc4kCController : DmInputCardControllerBase -// { -// public override eDmInputCardType Type -// { -// get { return eDmInputCardType.Dmc4kC; } -// } -// public Dmc4kC Card { get; private set; } - -// //public RoutingInputPortWithVideoStatuses DmIn { get; private set; } -// //public RoutingOutputPort HdmiLoopOut { get; private set; } -// //public RoutingOutputPort AudioLoopOut { get; private set; } - -// public Dmc4kCController(string key, Dmc4kC card, uint slot) -// : base(key, slot) -// { -// Card = card; -// //DmIn = new RoutingInputPortWithVideoStatuses(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.DmCat, null, this, -// // VideoStatusHelper.GetDmInputStatusFuncs(Card.DmInput)); - -// //HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this); -// //AudioLoopOut = new RoutingOutputPort(DmPortName.AudioLoopOut, eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.Hdmi, null, this); - -// //InputPorts.Add(DmIn); -// //OutputPorts.AddRange(new[] { HdmiLoopOut, AudioLoopOut }); -// } -// } - -// public class Dmc4kCDspController : DmInputCardControllerBase -// { -// public override eDmInputCardType Type -// { -// get { return eDmInputCardType.Dmc4kCDsp; } -// } -// public Dmc4kCDsp Card { get; private set; } - -// //public RoutingInputPortWithVideoStatuses DmIn { get; private set; } -// //public RoutingOutputPort HdmiLoopOut { get; private set; } -// //public RoutingOutputPort AudioLoopOut { get; private set; } - -// public Dmc4kCDspController(string key, Dmc4kCDsp card, uint slot) -// : base(key, slot) -// { -// Card = card; -// //DmIn = new RoutingInputPortWithVideoStatuses(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.DmCat, null, this, -// // VideoStatusHelper.GetDmInputStatusFuncs(Card.DmInput)); - -// //HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this); -// //AudioLoopOut = new RoutingOutputPort(DmPortName.AudioLoopOut, eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.Hdmi, null, this); - -// //InputPorts.Add(DmIn); -// //OutputPorts.AddRange(new[] { HdmiLoopOut, AudioLoopOut }); -// } -// } - -//} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcHD4kInputCard.cs b/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcHD4kInputCard.cs deleted file mode 100644 index 4f5f5c8b..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Cards REMOVE/DmcHD4kInputCard.cs +++ /dev/null @@ -1,82 +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 Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; - -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.DM; - -//namespace PepperDash.Essentials.DM.Cards -//{ -// /// -// /// -// /// -// public class Dmc4kHdController : DmInputCardControllerBase -// { -// public Dmc4kHd Card { get; private set; } -// public override eDmInputCardType Type -// { -// get { return eDmInputCardType.Dmc4kHd; } -// } - -// public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; } -// public RoutingOutputPort HdmiLoopOut { get; private set; } -// public RoutingOutputPort AudioLoopOut { get; private set; } - -// public Dmc4kHdController(string key, Dmc4kHd card, uint slot) -// : base(key, slot) -// { -// Card = card; -// HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// eRoutingPortConnectionType.Hdmi, null, this, -// VideoStatusHelper.GetHdmiInputStatusFuncs(Card.HdmiInput)); - -// HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// eRoutingPortConnectionType.Hdmi, null, this); -// AudioLoopOut = new RoutingOutputPort(DmPortName.AudioLoopOut, eRoutingSignalType.Audio, -// eRoutingPortConnectionType.Hdmi, null, this); - -// InputPorts.Add(HdmiIn); -// OutputPorts.AddRange(new[] { HdmiLoopOut, AudioLoopOut }); -// } -// } - -// /// -// /// -// /// -// public class Dmc4kHdDspController : DmInputCardControllerBase -// { -// public Dmc4kHdDsp Card { get; private set; } -// public override eDmInputCardType Type -// { -// get { return eDmInputCardType.Dmc4kHdDsp; } -// } - -// //public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; } -// //public RoutingOutputPort HdmiLoopOut { get; private set; } -// //public RoutingOutputPort AudioLoopOut { get; private set; } - -// public Dmc4kHdDspController(string key, Dmc4kHdDsp card, uint slot) -// : base(key, slot) -// { -// Card = card; -// //HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this, -// // VideoStatusHelper.GetHdmiInputStatusFuncs(Card.HdmiInput)); - -// //HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, -// // eRoutingPortConnectionType.Hdmi, null, this); -// //AudioLoopOut = new RoutingOutputPort(DmPortName.AudioLoopOut, eRoutingSignalType.Audio, -// // eRoutingPortConnectionType.Hdmi, null, this); - -// //InputPorts.Add(HdmiIn); -// //OutputPorts.AddRange(new[] { HdmiLoopOut, AudioLoopOut }); -// } -// } -//} - diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json b/essentials-framework/Essentials DM/Essentials_DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json new file mode 100644 index 00000000..7769bdbc --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/Config/Schema/DmChassisControllerPropertiesConfigSchema.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-03/schema#", + "title": "DmChassisController Properties Config Schema", + "description": "", + "$ref": "EssentialsConfigSchema.json#definitions/Device", + "properties": { + "properties": { + "$ref": "#/propertiesConfig" + } + }, + "propertiesConfig": { + "type": "object", + "additionalProperties": true, + "properties": { + "control": { + "required":true, + "type": "object", + "$ref": "../../ControlPropertiesConfigSchema.json#/ControlPropertiesConfig" + }, + "volumeControls": { + "title": "Volume Controls", + "type": "object", + "additionalProperties": { + "type": "object", + "$ref": "#/dmAudioCardPropertiesConfig" + } + }, + "inputSlots": { + "required":true, + "title": "Input Slots", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "outputSlots": { + "required":true, + "title": "Output Slots", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "inputNames": { + "title": "Input Names", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "outputNames": { + "title": "Output Names", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "noRouteText": { + "title": "No Route Text", + "type": "string" + }, + "inputSlotSupportsHdcp2": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + } + } + }, + "dmAudioCardPropertiesConfig": { + "type": "object", + "properties": { + "OutLevel": { + "title": "Output Level", + "type": "integer" + }, + "isVolumeControlPoint": { + "title": "Volume Control Point?", + "type": "boolean" + } + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 136f3c86..d0a6ba63 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -66,6 +66,11 @@ namespace PepperDash.Essentials.DM public const int RouteOffTime = 500; Dictionary RouteOffTimers = new Dictionary(); + /// + /// Text that represents when an output has no source routed to it + /// + public string NoRouteText = ""; + /// /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now /// @@ -99,9 +104,12 @@ namespace PepperDash.Essentials.DM } var controller = new DmChassisController(key, name, chassis); + // add the cards and port names - foreach (var kvp in properties.InputSlots) - controller.AddInputCard(kvp.Value, kvp.Key); + foreach (var kvp in properties.InputSlots) + { + controller.AddInputCard(kvp.Value, kvp.Key); + } foreach (var kvp in properties.OutputSlots) { controller.AddOutputCard(kvp.Value, kvp.Key); @@ -128,6 +136,15 @@ namespace PepperDash.Essentials.DM controller.InputNames = properties.InputNames; controller.OutputNames = properties.OutputNames; + + if (!string.IsNullOrEmpty(properties.NoRouteText)) + { + controller.NoRouteText = properties.NoRouteText; + Debug.Console(1, controller, "Setting No Route Text value to: {0}", controller.NoRouteText); + } + else + Debug.Console(1, controller, "NoRouteText not specified. Defaulting to blank string.", controller.NoRouteText); + controller.PropertiesConfig = properties; return controller; } @@ -174,11 +191,18 @@ namespace PepperDash.Essentials.DM SystemIdBusyFeedback = new BoolFeedback(() => { return (Chassis as DmMDMnxn).SystemIdBusy.BoolValue; }); InputCardHdcpCapabilityFeedbacks = new Dictionary(); InputCardHdcpCapabilityTypes = new Dictionary(); + } + public override bool CustomActivate() + { + Debug.Console(2, this, "Setting up feedbacks."); - for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) + // Setup Output Card Feedbacks + for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) { - var tempX = x; + var tempX = x; + + Debug.Console(2, this, "Setting up feedbacks for output slot: {0}", tempX); if (Chassis.Outputs[tempX] != null) { @@ -217,30 +241,45 @@ namespace PepperDash.Essentials.DM } else { - return ""; + return NoRouteText; } }); OutputAudioRouteNameFeedbacks[tempX] = new StringFeedback(() => + { + if (Chassis.Outputs[tempX].AudioOutFeedback != null) { - if (Chassis.Outputs[tempX].AudioOutFeedback != null) - { - return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue; - } - else - { - return ""; + return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue; + } + else + { + return NoRouteText; - } - }); + } + }); - OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => + OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[tempX].EndpointOnlineFeedback; }); } + else + { + Debug.Console(2, this, "No Output Card defined in slot: {0}", tempX); + } + }; + + // Setup Input Card Feedbacks + for (uint x = 1; x <= Chassis.NumberOfInputs; x++) + { + var tempX = x; + + Debug.Console(2, this, "Setting up feedbacks for input slot: {0}", tempX); + + CheckForHdcp2Property(tempX); if (Chassis.Inputs[tempX] != null) { + UsbInputRoutedToFeebacks[tempX] = new IntFeedback(() => { if (Chassis.Inputs[tempX].USBRoutedToFeedback != null) { return (ushort)Chassis.Inputs[tempX].USBRoutedToFeedback.Number; } @@ -265,7 +304,7 @@ namespace PepperDash.Essentials.DM } }); - InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => + InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; }); @@ -274,6 +313,8 @@ namespace PepperDash.Essentials.DM { var inputCard = Chassis.Inputs[tempX]; + Debug.Console(2, this, "Adding InputCardHdcpCapabilityFeedback for slot: {0}", inputCard); + if (inputCard.Card is DmcHd) { InputCardHdcpCapabilityTypes[tempX] = eHdcpCapabilityType.HdcpAutoSupport; @@ -328,8 +369,32 @@ namespace PepperDash.Essentials.DM return 0; }); } - } - } + else + { + Debug.Console(2, this, "No Input Card defined in slot: {0}", tempX); + } + } + + return base.CustomActivate(); + } + + /// + /// Checks for presence of config property defining if the input card supports HDCP2. + /// If not found, assumes false. + /// + /// Input Slot + void CheckForHdcp2Property(uint inputSlot) + { + if (!PropertiesConfig.InputSlotSupportsHdcp2.ContainsKey(inputSlot)) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Warning, +@"Properties Config does not define inputSlotSupportsHdcp2 entry for input card: {0}. Assuming false. +If HDCP2 is required, HDCP control/feedback will not fucntion correctly!", inputSlot); + PropertiesConfig.InputSlotSupportsHdcp2.Add(inputSlot, false); + } + else + Debug.Console(2, this, "inputSlotSupportsHdcp2 for input card: {0} = {1}", inputSlot, PropertiesConfig.InputSlotSupportsHdcp2[inputSlot]); + } /// /// @@ -552,6 +617,13 @@ namespace PepperDash.Essentials.DM var cecPort2 = outputCard.Card2.HdmiOutput; AddDmcHdoPorts(number, cecPort1, cecPort2); } + else if (type == "dmc4kzhdo") + { + var outputCard = new Dmc4kzHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } else if (type == "dmchdo") { var outputCard = new DmcHdoSingle(number, Chassis); @@ -565,13 +637,13 @@ namespace PepperDash.Essentials.DM var cecPort1 = outputCard.Card1.HdmiOutput; AddDmcCoPorts(number, cecPort1); } - else if (type == "dmc4kzcohd") - { + else if (type == "dmc4kzcohd") + { var outputCard = new Dmc4kzCoHdSingle(number, Chassis); var cecPort1 = outputCard.Card1.HdmiOutput; AddDmcCoPorts(number, cecPort1); } - else if (type == "dmccohd") + else if (type == "dmccohd") { var outputCard = new DmcCoHdSingle(number, Chassis); var cecPort1 = outputCard.Card1.HdmiOutput; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 0c4ff887..6ed0e63b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -48,6 +48,11 @@ namespace PepperDash.Essentials.DM public const int RouteOffTime = 500; Dictionary RouteOffTimers = new Dictionary(); + /// + /// Text that represents when an output has no source routed to it + /// + public string NoRouteText = ""; + public static DmpsRoutingController GetDmpsRoutingController(string key, string name, DmpsRoutingPropertiesConfig properties) { @@ -67,6 +72,9 @@ namespace PepperDash.Essentials.DM controller.InputNames = properties.InputNames; controller.OutputNames = properties.OutputNames; + if (!string.IsNullOrEmpty(properties.NoRouteText)) + controller.NoRouteText = properties.NoRouteText; + return controller; } @@ -191,7 +199,7 @@ namespace PepperDash.Essentials.DM } else { - return ""; + return NoRouteText; } }); OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => @@ -202,7 +210,7 @@ namespace PepperDash.Essentials.DM } else { - return ""; + return NoRouteText; } }); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DMChassisConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DMChassisConfig.cs index 22da6c44..5e158985 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DMChassisConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DMChassisConfig.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM.Cards; namespace PepperDash.Essentials.DM.Config { @@ -32,6 +31,9 @@ namespace PepperDash.Essentials.DM.Config [JsonProperty("outputNames")] public Dictionary OutputNames { get; set; } + [JsonProperty("noRouteText")] + public string NoRouteText { get; set; } + [JsonProperty("inputSlotSupportsHdcp2")] public Dictionary InputSlotSupportsHdcp2 { get; set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DmRmcConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DmRmcConfig.cs index 702e10b5..0c511d35 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DmRmcConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DmRmcConfig.cs @@ -4,7 +4,6 @@ using Crestron.SimplSharpPro.DM; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Core; -using PepperDash.Essentials.DM.Cards; namespace PepperDash.Essentials.DM.Config { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DmTxConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DmTxConfig.cs index 51d074f8..7727ed7f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DmTxConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DmTxConfig.cs @@ -4,7 +4,6 @@ using Crestron.SimplSharpPro.DM; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Core; -using PepperDash.Essentials.DM.Cards; namespace PepperDash.Essentials.DM.Config { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/DmpsRoutingConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/DmpsRoutingConfig.cs index 57dd4a72..2e13ec95 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/DmpsRoutingConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/DmpsRoutingConfig.cs @@ -5,7 +5,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM.Cards; namespace PepperDash.Essentials.DM.Config { @@ -20,6 +19,9 @@ namespace PepperDash.Essentials.DM.Config [JsonProperty("outputNames")] public Dictionary OutputNames { get; set; } + [JsonProperty("noRouteText")] + public string NoRouteText { get; set; } + public DmpsRoutingPropertiesConfig() { InputNames = new Dictionary(); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvx35xController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvx35xController.cs deleted file mode 100644 index cd12ea04..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvx35xController.cs +++ /dev/null @@ -1,19 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; - -//using Crestron.SimplSharpPro.DM.Streaming; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; - -//namespace PepperDash.Essentials.DM.Endpoints.NVX -//{ -// public class DmNvx35xController: DmNvxControllerBase -// { - - -// } -//} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxConfig.cs deleted file mode 100644 index b4cecc4e..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxConfig.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DM.Streaming; - -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using PepperDash.Core; - -namespace PepperDash.Essentials.DM.Endpoints.NVX -{ - /// - /// Represents the "properties" property of a DM NVX device config - /// - public class DmNvxConfig - { - [JsonProperty("control")] - public ControlPropertiesConfig Control { get; set; } - - [JsonProperty("parrentDeviceKey")] - public string ParentDeviceKey { get; set; } - - [JsonProperty("deviceMode")] - public eDeviceMode DeviceMode { get; set; } - - - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxControllerBase.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxControllerBase.cs deleted file mode 100644 index 6063b893..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/NVX/DmNvxControllerBase.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DM.Streaming; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.DM.Endpoints.NVX -{ - public abstract class DmNvxControllerBase: CrestronGenericBaseDevice - { - public DmNvx35x DmNvx { get; private set; } - - - - public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; } - public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; } - - - public DmNvxControllerBase(string key, string name, DmNvxBaseClass hardware) - : base(key, name, hardware) - { - AddToFeedbackList(ActiveVideoInputFeedback); - } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 2a898b19..42ecf5c6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFeedback + public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx200C2G Tx { get; private set; } @@ -32,8 +32,10 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -115,7 +117,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; @@ -123,6 +125,14 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + + var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => @@ -170,6 +180,21 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { ActiveVideoInputFeedback.FireUpdate(); @@ -191,6 +216,40 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs index 224510aa..37ee38b3 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback + public class DmTx201XController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C @@ -33,8 +33,10 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -116,12 +118,19 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; }); + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; var combinedFuncs = new VideoStatusFuncsWrapper @@ -156,7 +165,7 @@ namespace PepperDash.Essentials.DM }; AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, @@ -174,6 +183,21 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) { ActiveVideoInputFeedback.FireUpdate(); @@ -183,8 +207,7 @@ namespace PepperDash.Essentials.DM } public override bool CustomActivate() - { - + { Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId); @@ -195,6 +218,46 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + /// + /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable) + /// + /// + /// + /// public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); @@ -250,6 +313,7 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); } + } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) @@ -264,6 +328,10 @@ namespace PepperDash.Essentials.DM { HdmiInHdcpCapabilityFeedback.FireUpdate(); } + else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) + { + FreeRunEnabledFeedback.FireUpdate(); + } } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index b0356f0d..18e91fbe 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials.DM { using eVst = DmTx401C.eSourceSelection; - public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts + public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } @@ -34,6 +34,11 @@ namespace PepperDash.Essentials.DM public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } + /// /// Helps get the "real" inputs, including when in Auto /// @@ -122,7 +127,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; @@ -130,6 +135,13 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + var combinedFuncs = new VideoStatusFuncsWrapper { HdcpActiveFeedbackFunc = () => @@ -269,6 +281,55 @@ namespace PepperDash.Essentials.DM } } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + /// /// Relays the input stream change to the appropriate RoutingInputPort. /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs index cb91f857..baaac013 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback, - IIROutputPorts, IComPorts + IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx4k302C Tx { get; private set; } @@ -35,8 +35,10 @@ namespace PepperDash.Essentials.DM public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } + public BoolFeedback FreeRunEnabledFeedback { get; protected set; } + + public IntFeedback VgaBrightnessFeedback { get; protected set; } + public IntFeedback VgaContrastFeedback { get; protected set; } /// /// Helps get the "real" inputs, including when in Auto @@ -122,6 +124,13 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); + + VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); + + tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + var combinedFuncs = new VideoStatusFuncsWrapper { @@ -181,6 +190,21 @@ namespace PepperDash.Essentials.DM DmOut.Port = Tx.DmOutput; } + void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + { + VgaBrightnessFeedback.FireUpdate(); + } + else if (id == VideoControlsEventIds.ContrastFeedbackEventId) + { + VgaContrastFeedback.FireUpdate(); + } + } + public override bool CustomActivate() @@ -199,6 +223,42 @@ namespace PepperDash.Essentials.DM return base.CustomActivate(); } + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + if (enable) + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; + } + else + { + Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; + } + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + } + + + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs new file mode 100644 index 00000000..50955dda --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/TxInterfaces.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.DM +{ + /// + /// Defines a device capable of setting the Free Run state of a VGA input and reporting feedback + /// + public interface IHasFreeRun + { + BoolFeedback FreeRunEnabledFeedback { get; } + + void SetFreeRunEnabled(bool enable); + } + + /// + /// Defines a device capable of adjusting VGA settings + /// + public interface IVgaBrightnessContrastControls + { + IntFeedback VgaBrightnessFeedback { get; } + IntFeedback VgaContrastFeedback { get; } + + void SetVgaBrightness(ushort level); + void SetVgaContrast(ushort level); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj index 74f4d9b7..e862f8a1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -82,6 +82,10 @@ ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe False + + False + ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + @@ -89,12 +93,6 @@ - - - - - - @@ -102,6 +100,7 @@ + @@ -110,9 +109,6 @@ - - - @@ -141,10 +137,6 @@ - - - Code - diff --git a/essentials-framework/Essentials DM/Essentials_DM/MOVE IBasicVideoStatusFeedbacks.cs b/essentials-framework/Essentials DM/Essentials_DM/MOVE IBasicVideoStatusFeedbacks.cs deleted file mode 100644 index 26b950ce..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/MOVE IBasicVideoStatusFeedbacks.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.DM -{ - public interface IBasicVideoStatusFeedbacks - { - BoolFeedback HasVideoStatusFeedback { get; } - BoolFeedback HdcpActiveFeedback { get; } - StringFeedback HdcpStateFeedback { get; } - StringFeedback VideoResolutionFeedback { get; } - BoolFeedback VideoSyncFeedback { get; } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Nvx/NvxDirectorController.cs b/essentials-framework/Essentials DM/Essentials_DM/Nvx/NvxDirectorController.cs deleted file mode 100644 index 49986c50..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Nvx/NvxDirectorController.cs +++ /dev/null @@ -1,746 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DM; -//using Crestron.SimplSharpPro.DM.Cards; -//using Crestron.SimplSharpPro.DM.Streaming; -//using Crestron.SimplSharpPro.DM.Endpoints; -//using Crestron.SimplSharpPro.DM.Endpoints.Receivers; - -//using PepperDash.Core; -//using PepperDash.Essentials.Core; -//using PepperDash.Essentials.DM.Cards; -//using PepperDash.Essentials.DM.Config; - -//namespace PepperDash.Essentials.DM -//{ -// /// -// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions -// /// -// /// -// public class NvxDirectorController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback//, ICardPortsDevice -// { -// public NvxDirectorController Chassis { get; private set; } - -// // Feedbacks for EssentialDM -// public Dictionary VideoOutputFeedbacks { get; private set; } -// public Dictionary AudioOutputFeedbacks { get; private set; } -// public Dictionary VideoInputSyncFeedbacks { get; private set; } -// public Dictionary InputEndpointOnlineFeedbacks { get; private set; } -// public Dictionary OutputEndpointOnlineFeedbacks { get; private set; } -// public Dictionary InputNameFeedbacks { get; private set; } -// public Dictionary OutputNameFeedbacks { get; private set; } -// public Dictionary OutputVideoRouteNameFeedbacks { get; private set; } -// public Dictionary OutputAudioRouteNameFeedbacks { get; private set; } - - -// // Need a couple Lists of generic Backplane ports -// public RoutingPortCollection InputPorts { get; private set; } -// public RoutingPortCollection OutputPorts { get; private set; } - -// public Dictionary TxDictionary { get; set; } -// public Dictionary RxDictionary { get; set; } - -// //public Dictionary InputCards { get; private set; } -// //public Dictionary OutputCards { get; private set; } - -// public Dictionary InputNames { get; set; } -// public Dictionary OutputNames { get; set; } -// public Dictionary VolumeControls { get; private set; } - -// public const int RouteOffTime = 500; -// Dictionary RouteOffTimers = new Dictionary(); - -// /// -// /// Factory method to create a new chassis controller from config data. Limited to 8x8 right now -// /// -// public static NvxDirectorController GetNvxDirectorController(string key, string name, -// string type, DMChassisPropertiesConfig properties) -// { -// try -// { -// type = type.ToLower(); -// uint ipid = properties.Control.IpIdInt; // Convert.ToUInt16(properties.Id, 16); -// NvxDirectorController controller = null; - - -// if (type == "dmmd8x8") -// { -// controller = new NvxDirectorController(key, name, new DmMd8x8(ipid, Global.ControlSystem)); - -// // add the cards and port names -// foreach (var kvp in properties.InputSlots) -// controller.AddInputCard(kvp.Value, kvp.Key); -// foreach (var kvp in properties.OutputSlots) { -// controller.AddOutputCard(kvp.Value, kvp.Key); - -// } - -// foreach (var kvp in properties.VolumeControls) -// { -// // get the card -// // check it for an audio-compatible type -// // make a something-something that will make it work -// // retire to mountain village -// var outNum = kvp.Key; -// var card = controller.Chassis.Outputs[outNum].Card; -// Audio.Output audio = null; -// if (card is DmcHdo) -// audio = (card as DmcHdo).Audio; -// else if (card is Dmc4kHdo) -// audio = (card as Dmc4kHdo).Audio; -// if (audio == null) -// continue; -// // wire up the audio to something here... -// controller.AddVolumeControl(outNum, audio); -// } - -// controller.InputNames = properties.InputNames; -// controller.OutputNames = properties.OutputNames; -// return controller; -// } -// else if (type == "dmmd16x16") { -// controller = new NvxDirectorController(key, name, new DmMd16x16(ipid, Global.ControlSystem)); - -// // add the cards and port names -// foreach (var kvp in properties.InputSlots) -// controller.AddInputCard(kvp.Value, kvp.Key); -// foreach (var kvp in properties.OutputSlots) { -// controller.AddOutputCard(kvp.Value, kvp.Key); - -// } - -// foreach (var kvp in properties.VolumeControls) { -// // get the card -// // check it for an audio-compatible type -// // make a something-something that will make it work -// // retire to mountain village -// var outNum = kvp.Key; -// var card = controller.Chassis.Outputs[outNum].Card; -// Audio.Output audio = null; -// if (card is DmcHdo) -// audio = (card as DmcHdo).Audio; -// else if (card is Dmc4kHdo) -// audio = (card as Dmc4kHdo).Audio; -// if (audio == null) -// continue; -// // wire up the audio to something here... -// controller.AddVolumeControl(outNum, audio); -// } - -// controller.InputNames = properties.InputNames; -// controller.OutputNames = properties.OutputNames; -// return controller; -// } -// } -// catch (System.Exception e) -// { -// Debug.Console(0, "Error creating DM chassis:\r{0}", e); -// } -// return null; -// } - - -// /// -// /// -// /// -// /// -// /// -// /// -// public NvxDirectorController(string key, string name, DmMDMnxn chassis) -// : base(key, name, chassis) -// { -// Chassis = chassis; -// InputPorts = new RoutingPortCollection(); -// OutputPorts = new RoutingPortCollection(); -// VolumeControls = new Dictionary(); -// TxDictionary = new Dictionary(); -// RxDictionary = new Dictionary(); -// IsOnline.OutputChange += new EventHandler(IsOnline_OutputChange); -// //IsOnline.OutputChange += new EventHandler(this.IsOnline_OutputChange); -// Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); -// //Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange); -// Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); -// VideoOutputFeedbacks = new Dictionary(); -// AudioOutputFeedbacks = new Dictionary(); -// VideoInputSyncFeedbacks = new Dictionary(); -// InputNameFeedbacks = new Dictionary(); -// OutputNameFeedbacks = new Dictionary(); -// OutputVideoRouteNameFeedbacks = new Dictionary(); -// OutputAudioRouteNameFeedbacks = new Dictionary(); -// InputEndpointOnlineFeedbacks = new Dictionary(); -// OutputEndpointOnlineFeedbacks = new Dictionary(); - -// for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) -// { -// var tempX = x; - -// VideoOutputFeedbacks[tempX] = new IntFeedback(() => { -// if (Chassis.Outputs[tempX].VideoOutFeedback != null) { return (ushort)Chassis.Outputs[tempX].VideoOutFeedback.Number;} -// else { return 0; }; -// }); -// AudioOutputFeedbacks[tempX] = new IntFeedback(() => { -// if (Chassis.Outputs[tempX].AudioOutFeedback != null) { return (ushort)Chassis.Outputs[tempX].AudioOutFeedback.Number; } -// else { return 0; }; -// }); -// VideoInputSyncFeedbacks[tempX] = new BoolFeedback(() => { -// return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue; -// }); -// InputNameFeedbacks[tempX] = new StringFeedback(() => { -// if (Chassis.Inputs[tempX].NameFeedback.StringValue != null) -// { -// return Chassis.Inputs[tempX].NameFeedback.StringValue; -// } -// else -// { -// return ""; -// } -// }); -// OutputNameFeedbacks[tempX] = new StringFeedback(() => { -// if (Chassis.Outputs[tempX].NameFeedback.StringValue != null) -// { -// return Chassis.Outputs[tempX].NameFeedback.StringValue; -// } -// else -// { -// return ""; -// } -// }); -// OutputVideoRouteNameFeedbacks[tempX] = new StringFeedback(() => -// { -// if (Chassis.Outputs[tempX].VideoOutFeedback != null) -// { -// return Chassis.Outputs[tempX].VideoOutFeedback.NameFeedback.StringValue; -// } -// else -// { -// return ""; -// } -// }); -// OutputAudioRouteNameFeedbacks[tempX] = new StringFeedback(() => -// { -// if (Chassis.Outputs[tempX].AudioOutFeedback != null) -// { -// return Chassis.Outputs[tempX].AudioOutFeedback.NameFeedback.StringValue; -// } -// else -// { -// return ""; - -// } -// }); -// InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; }); - -// OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[tempX].EndpointOnlineFeedback; }); -// } -// } - -// /// -// /// -// /// -// /// -// /// -// public void AddInputCard(string type, uint number) -// { -// Debug.Console(2, this, "Adding input card '{0}', slot {1}", type, number); - -// if (type == "dmcHd") -// { -// var inputCard = new DmcHd(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmcHdDsp") -// { -// var inputCard = new DmcHdDsp(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmc4kHd") -// { -// var inputCard = new Dmc4kHd(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmc4kHdDsp") -// { -// var inputCard = new Dmc4kHdDsp(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmc4kzHd") -// { -// var inputCard = new Dmc4kzHd(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmc4kzHdDsp") -// { -// var inputCard = new Dmc4kzHdDsp(number, this.Chassis); -// var cecPort = inputCard.HdmiInput as ICec; -// AddHdmiInCardPorts(number, cecPort); -// } -// else if (type == "dmcC") -// { -// new DmcC(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmcCDsp") -// { -// new DmcCDsp(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmc4kC") -// { -// new Dmc4kC(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmc4kCDsp") -// { -// new Dmc4kCDsp(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmc4kzC") -// { -// new Dmc4kzC(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmc4kzCDsp") -// { -// new Dmc4kzCDsp(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmcCat") -// { -// new DmcCat(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmcCatDsp") -// { -// new DmcCatDsp(number, this.Chassis); -// AddDmInCardPorts(number); -// } -// else if (type == "dmcS") -// { -// new DmcS(number, Chassis); -// AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// else if (type == "dmcSDsp") -// { -// new DmcSDsp(number, Chassis); -// AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// else if (type == "dmcS2") -// { -// new DmcS2(number, Chassis); -// AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// else if (type == "dmcS2Dsp") -// { -// new DmcS2Dsp(number, Chassis); -// AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// else if (type == "dmcSdi") -// { -// new DmcSdi(number, Chassis); -// AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi); -// AddOutputPortWithDebug(number, "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi, null); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// else if (type == "dmcDvi") -// { -// new DmcDvi(number, Chassis); -// AddInputPortWithDebug(number, "dviIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Dvi); -// AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcVga") -// { -// new DmcVga(number, Chassis); -// AddInputPortWithDebug(number, "vgaIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Vga); -// AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcVidBnc") -// { -// new DmcVidBnc(number, Chassis); -// AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); -// AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcVidRcaA") -// { -// new DmcVidRcaA(number, Chassis); -// AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); -// AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcVidRcaD") -// { -// new DmcVidRcaD(number, Chassis); -// AddInputPortWithDebug(number, "componentIn", eRoutingSignalType.Video, eRoutingPortConnectionType.Component); -// AddInputPortWithDebug(number, "audioIn", eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcVid4") -// { -// new DmcVid4(number, Chassis); -// AddInputPortWithDebug(number, "compositeIn1", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite); -// AddInputPortWithDebug(number, "compositeIn2", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite); -// AddInputPortWithDebug(number, "compositeIn3", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite); -// AddInputPortWithDebug(number, "compositeIn4", eRoutingSignalType.Video, eRoutingPortConnectionType.Composite); -// AddInCardHdmiLoopPort(number); -// } -// else if (type == "dmcStr") -// { -// new DmcStr(number, Chassis); -// AddInputPortWithDebug(number, "streamIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming); -// AddInCardHdmiAndAudioLoopPorts(number); -// } -// } - -// void AddDmInCardPorts(uint number) -// { -// AddInputPortWithDebug(number, "dmIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat); -// AddInCardHdmiAndAudioLoopPorts(number); -// } - -// void AddHdmiInCardPorts(uint number, ICec cecPort) -// { -// AddInputPortWithDebug(number, "hdmiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort); -// AddInCardHdmiAndAudioLoopPorts(number); -// } - -// void AddInCardHdmiAndAudioLoopPorts(uint number) -// { -// AddOutputPortWithDebug(number, "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null); -// AddOutputPortWithDebug(number, "audioLoopOut", eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null); -// } - -// void AddInCardHdmiLoopPort(uint number) -// { -// AddOutputPortWithDebug(number, "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null); -// } - -// /// -// /// -// /// -// /// -// /// -// public void AddOutputCard(string type, uint number) -// { -// Debug.Console(2, this, "Adding output card '{0}', slot {1}", type, number); -// if (type == "dmc4kHdo") -// { -// var outputCard = new Dmc4kHdoSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// var cecPort2 = outputCard.Card2.HdmiOutput; -// AddDmcHdoPorts(number, cecPort1, cecPort2); -// } -// else if (type == "dmcHdo") -// { -// var outputCard = new DmcHdoSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// var cecPort2 = outputCard.Card2.HdmiOutput; -// AddDmcHdoPorts(number, cecPort1, cecPort2); -// } -// else if (type == "dmc4kCoHd") -// { -// var outputCard = new Dmc4kCoHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddDmcCoPorts(number, cecPort1); -// } -// else if (type == "dmc4kzCoHd") -// { -// var outputCard = new Dmc4kzCoHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddDmcCoPorts(number, cecPort1); -// } -// else if (type == "dmcCoHd") -// { -// var outputCard = new DmcCoHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddDmcCoPorts(number, cecPort1); -// } -// else if (type == "dmCatoHd") -// { -// var outputCard = new DmcCatoHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddDmcCoPorts(number, cecPort1); -// } -// else if (type == "dmcSoHd") -// { -// var outputCard = new DmcSoHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 1); -// AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); -// AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2); - -// } -// else if (type == "dmcS2oHd") -// { -// var outputCard = new DmcS2oHdSingle(number, Chassis); -// var cecPort1 = outputCard.Card1.HdmiOutput; -// AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 1); -// AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); -// AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2); -// } -// else if (type == "dmcStro") -// { -// var outputCard = new DmcStroSingle(number, Chassis); -// AddOutputPortWithDebug(number, "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1); -// } - -// else -// Debug.Console(1, this, " WARNING: Output card type '{0}' is not available", type); -// } - -// void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2) -// { -// AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); -// AddOutputPortWithDebug(number, "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 1); -// AddOutputPortWithDebug(number, "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2); -// AddOutputPortWithDebug(number, "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 2); -// } - -// void AddDmcCoPorts(uint number, ICec cecPort1) -// { -// AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1); -// AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1); -// AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2); -// } - - -// /// -// /// Adds InputPort -// /// -// void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType) -// { -// var portKey = string.Format("inputCard{0}--{1}", cardNum, portName); -// Debug.Console(2, this, "Adding input port '{0}'", portKey); -// var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this); - -// InputPorts.Add(inputPort); -// } - -// /// -// /// Adds InputPort and sets Port as ICec object -// /// -// void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort) -// { -// var portKey = string.Format("inputCard{0}--{1}", cardNum, portName); -// Debug.Console(2, this, "Adding input port '{0}'", portKey); -// var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this); - -// if (cecPort != null) -// inputPort.Port = cecPort; - -// InputPorts.Add(inputPort); -// } - -// /// -// /// Adds OutputPort -// /// -// void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector) -// { -// var portKey = string.Format("outputCard{0}--{1}", cardNum, portName); -// Debug.Console(2, this, "Adding output port '{0}'", portKey); -// OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this)); -// } - -// /// -// /// Adds OutputPort and sets Port as ICec object -// /// -// void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort) -// { -// var portKey = string.Format("outputCard{0}--{1}", cardNum, portName); -// Debug.Console(2, this, "Adding output port '{0}'", portKey); -// var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this); - -// if (cecPort != null) -// outputPort.Port = cecPort; - -// OutputPorts.Add(outputPort); -// } - -// /// -// /// -// /// -// void AddVolumeControl(uint number, Audio.Output audio) -// { -// VolumeControls.Add(number, new DmCardAudioOutputController(audio)); -// } - -// //public void SetInputHdcpSupport(uint input, ePdtHdcpSupport hdcpSetting) -// //{ - -// //} - - -// void Chassis_DMSystemChange(Switch device, DMSystemEventArgs args) { - -// } -// void Chassis_DMInputChange(Switch device, DMInputEventArgs args) { -// //Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString()); - -// switch (args.EventId) { -// case (DMInputEventIds.OnlineFeedbackEventId): { -// Debug.Console(2, this, "DMINput OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback); -// InputEndpointOnlineFeedbacks[args.Number].FireUpdate(); -// break; -// } -// case (DMInputEventIds.VideoDetectedEventId): { -// Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number); -// VideoInputSyncFeedbacks[args.Number].FireUpdate(); -// break; -// } -// case (DMInputEventIds.InputNameEventId): { -// Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number); -// InputNameFeedbacks[args.Number].FireUpdate(); -// break; -// } -// } -// } -// /// -// /// -// void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) -// { - -// //This should be a switch case JTA 2018-07-02 -// var output = args.Number; -// if (args.EventId == DMOutputEventIds.VolumeEventId && -// VolumeControls.ContainsKey(output)) -// { -// VolumeControls[args.Number].VolumeEventFromChassis(); -// } -// else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId) -// { -// OutputEndpointOnlineFeedbacks[output].FireUpdate(); -// } -// else if (args.EventId == DMOutputEventIds.VideoOutEventId) -// { -// if (Chassis.Outputs[output].VideoOutFeedback != null) -// { -// Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output); -// } -// if (VideoOutputFeedbacks.ContainsKey(output)) -// { -// VideoOutputFeedbacks[output].FireUpdate(); - -// } -// if (OutputVideoRouteNameFeedbacks.ContainsKey(output)) -// { -// OutputVideoRouteNameFeedbacks[output].FireUpdate(); -// } -// } -// else if (args.EventId == DMOutputEventIds.AudioOutEventId) -// { -// if (Chassis.Outputs[output].AudioOutFeedback != null) -// { -// Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output); -// } -// if (AudioOutputFeedbacks.ContainsKey(output)) -// { -// AudioOutputFeedbacks[output].FireUpdate(); -// } -// } -// else if (args.EventId == DMOutputEventIds.OutputNameEventId) -// { -// Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output); -// OutputNameFeedbacks[output].FireUpdate(); -// } - -// } - -// /// -// /// -// /// -// /// -// void StartOffTimer(PortNumberType pnt) -// { -// if (RouteOffTimers.ContainsKey(pnt)) -// return; -// RouteOffTimers[pnt] = new CTimer(o => -// { -// ExecuteSwitch(0, pnt.Number, pnt.Type); -// }, RouteOffTime); -// } - - -// // Send out sigs when coming online -// void IsOnline_OutputChange(object sender, EventArgs e) -// { -// if (IsOnline.BoolValue) -// { -// if (InputNames != null) -// foreach (var kvp in InputNames) -// Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value; -// if (OutputNames != null) -// foreach(var kvp in OutputNames) -// Chassis.Outputs[kvp.Key].Name.StringValue = kvp.Value; -// } -// } - -// #region IRouting Members - -// public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType) -// { -// Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType); - -// var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail -// var output = Convert.ToUInt32(outputSelector); -// // Check to see if there's an off timer waiting on this and if so, cancel -// var key = new PortNumberType(output, sigType); -// if (input == 0) -// { -// StartOffTimer(key); -// } -// else -// { -// if(RouteOffTimers.ContainsKey(key)) -// { -// Debug.Console(2, this, "{0} cancelling route off due to new source", output); -// RouteOffTimers[key].Stop(); -// RouteOffTimers.Remove(key); -// } -// } - -// Card.DMICard inCard = input == 0 ? null : Chassis.Inputs[input]; - -// // NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE -// if (sigType != eRoutingSignalType.Audio) -// { -// Chassis.VideoEnter.BoolValue = true; -// Chassis.Outputs[output].VideoOut = inCard; -// } - -// if (sigType != eRoutingSignalType.Video) -// { -// Chassis.AudioEnter.BoolValue = true; -// Chassis.Outputs[output].AudioOut = inCard; -// } -// } - -// #endregion - -// } - -// //public struct PortNumberType -// //{ -// // public uint Number { get; private set; } -// // public eRoutingSignalType Type { get; private set; } - -// // public PortNumberType(uint number, eRoutingSignalType type) : this() -// // { -// // Number = number; -// // Type = type; -// // } -// //} -//} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs b/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs index d11fa984..1f506f3a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Properties/AssemblyInfo.cs @@ -1,7 +1,10 @@ using System.Reflection; +using Crestron.SimplSharp.Reflection; -[assembly: AssemblyTitle("Essentials_DM")] -[assembly: AssemblyCompany("PepperDash Technology Corp")] -[assembly: AssemblyProduct("Essentials_DM")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyVersion("1.3.*")] \ No newline at end of file +[assembly: System.Reflection.AssemblyTitle("Essentials_DM")] +[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] +[assembly: System.Reflection.AssemblyProduct("PepperDashEssentials")] +[assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash Technology Corp 2020")] +[assembly: System.Reflection.AssemblyVersion("0.0.0.*")] +[assembly: System.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] +[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs index 5a006388..57839471 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasScheduleAwareness.cs @@ -73,17 +73,18 @@ namespace PepperDash.Essentials.Devices.Common.Codec { // Iterate the meeting list and check if any meeting need to do anythingk + const double meetingTimeEpsilon = 0.0001; foreach (Meeting m in Meetings) { eMeetingEventChangeType changeType = eMeetingEventChangeType.Unkown; if (m.TimeToMeetingStart.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to start changeType = eMeetingEventChangeType.MeetingStartWarning; - else if (m.TimeToMeetingStart.TotalMinutes == 0) // Meeting Start + else if (Math.Abs(m.TimeToMeetingStart.TotalMinutes) < meetingTimeEpsilon) // Meeting Start changeType = eMeetingEventChangeType.MeetingStart; else if (m.TimeToMeetingEnd.TotalMinutes <= m.MeetingWarningMinutes.TotalMinutes) // Meeting is about to end changeType = eMeetingEventChangeType.MeetingEndWarning; - else if (m.TimeToMeetingEnd.TotalMinutes == 0) // Meeting has ended + else if (Math.Abs(m.TimeToMeetingEnd.TotalMinutes) < meetingTimeEpsilon) // Meeting has ended changeType = eMeetingEventChangeType.MeetingEnd; if (changeType != eMeetingEventChangeType.Unkown) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs index cdb832ab..318268f1 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/DSP/DspBase.cs @@ -49,4 +49,26 @@ namespace PepperDash.Essentials.Devices.Common.DSP { } + + + // Main program + // VTC + // ATC + // Mics, unusual + + public interface IBiampTesiraDspLevelControl : IBasicVolumeWithFeedback + { + /// + /// In BiAmp: Instance Tag, QSC: Named Control, Polycom: + /// + string ControlPointTag { get; } + int Index1 { get; } + int Index2 { get; } + bool HasMute { get; } + bool HasLevel { get; } + bool AutomaticUnmuteOnVolumeUp { get; } + } + + + } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs index 7888bace..34263818 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/NecPaSeriesProjector.cs @@ -218,26 +218,5 @@ namespace PepperDash.Essentials.Devices.Displays } - - #region INonStandardControls Members - - public Dictionary> GetNonStandardControls() - { - return new Dictionary> - { - { CommonBoolCue.PowerOn, o => PowerOn() }, - { CommonBoolCue.PowerOff, o => PowerOff() }, - { Cue.BoolCue("PictureMute", 0), o => - { - if((bool)o) - PictureMuteOn(); - else - PictureMuteOff(); } }, - { Cue.UShortCue("GetLampRemaining", 0), o => GetLampRemaining((int) o) }, - { Cue.StringCue("SelectInput", 0), o => SelectInput((String)o) } - }; - } - - #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs index 4c7779ab..975487e0 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/SamsungMDCDisplay.cs @@ -167,84 +167,91 @@ namespace PepperDash.Essentials.Devices.Displays /// void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e) { - // This is probably not thread-safe buffering - // Append the incoming bytes with whatever is in the buffer - var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length]; - IncomingBuffer.CopyTo(newBytes, 0); - e.Bytes.CopyTo(newBytes, IncomingBuffer.Length); - - if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 - Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes)); - - // Need to find AA FF and have - for (int i = 0; i < newBytes.Length; i++) + try { - if (newBytes[i] == 0xAA && newBytes[i + 1] == 0xFF) + // This is probably not thread-safe buffering + // Append the incoming bytes with whatever is in the buffer + var newBytes = new byte[IncomingBuffer.Length + e.Bytes.Length]; + IncomingBuffer.CopyTo(newBytes, 0); + e.Bytes.CopyTo(newBytes, IncomingBuffer.Length); + + if (Debug.Level == 2) // This check is here to prevent following string format from building unnecessarily on level 0 or 1 + Debug.Console(2, this, "Received:{0}", ComTextHelper.GetEscapedText(newBytes)); + + // Need to find AA FF and have + for (int i = 0; i < newBytes.Length; i++) { - newBytes = newBytes.Skip(i).ToArray(); // Trim off junk if there's "dirt" in the buffer - - // parse it - // If it's at least got the header, then process it, - while (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF) + if (newBytes[i] == 0xAA && newBytes[i + 1] == 0xFF) { - var msgLen = newBytes[3]; - // if the buffer is shorter than the header (3) + message (msgLen) + checksum (1), - // give and save it for next time - if (newBytes.Length < msgLen + 4) - break; + newBytes = newBytes.Skip(i).ToArray(); // Trim off junk if there's "dirt" in the buffer - // Good length, grab the message - var message = newBytes.Skip(4).Take(msgLen).ToArray(); - - // At this point, the ack/nak is the first byte - if (message[0] == 0x41) + // parse it + // If it's at least got the header, then process it, + while (newBytes.Length > 4 && newBytes[0] == 0xAA && newBytes[1] == 0xFF) { - switch (message[1]) // type byte + var msgLen = newBytes[3]; + // if the buffer is shorter than the header (3) + message (msgLen) + checksum (1), + // give and save it for next time + if (newBytes.Length < msgLen + 4) + break; + + // Good length, grab the message + var message = newBytes.Skip(4).Take(msgLen).ToArray(); + + // At this point, the ack/nak is the first byte + if (message[0] == 0x41) { - case 0x00: // General status - //UpdatePowerFB(message[2], message[5]); // "power" can be misrepresented when the display sleeps + switch (message[1]) // type byte + { + case 0x00: // General status + //UpdatePowerFB(message[2], message[5]); // "power" can be misrepresented when the display sleeps - // Handle the first power on fb when waiting for it. - if (IsPoweringOnIgnorePowerFb && message[2] == 0x01) - IsPoweringOnIgnorePowerFb = false; - // Ignore general-status power off messages when powering up - if (!(IsPoweringOnIgnorePowerFb && message[2] == 0x00)) - UpdatePowerFB(message[2]); - UpdateVolumeFB(message[3]); - UpdateMuteFb(message[4]); - UpdateInputFb(message[5]); - break; + // Handle the first power on fb when waiting for it. + if (IsPoweringOnIgnorePowerFb && message[2] == 0x01) + IsPoweringOnIgnorePowerFb = false; + // Ignore general-status power off messages when powering up + if (!(IsPoweringOnIgnorePowerFb && message[2] == 0x00)) + UpdatePowerFB(message[2]); + UpdateVolumeFB(message[3]); + UpdateMuteFb(message[4]); + UpdateInputFb(message[5]); + break; - case 0x11: - UpdatePowerFB(message[2]); - break; + case 0x11: + UpdatePowerFB(message[2]); + break; - case 0x12: - UpdateVolumeFB(message[2]); - break; + case 0x12: + UpdateVolumeFB(message[2]); + break; - case 0x13: - UpdateMuteFb(message[2]); - break; + case 0x13: + UpdateMuteFb(message[2]); + break; - case 0x14: - UpdateInputFb(message[2]); - break; + case 0x14: + UpdateInputFb(message[2]); + break; - default: - break; + default: + break; + } } + // Skip over what we've used and save the rest for next time + newBytes = newBytes.Skip(5 + msgLen).ToArray(); } - // Skip over what we've used and save the rest for next time - newBytes = newBytes.Skip(5 + msgLen).ToArray(); - } - - break; // parsing will mean we can stop looking for header in loop - } - } - // Save whatever partial message is here - IncomingBuffer = newBytes; + break; // parsing will mean we can stop looking for header in loop + } + } + + // Save whatever partial message is here + IncomingBuffer = newBytes; + } + catch (Exception err) + { + Debug.Console(2, this, "Error parsing feedback: {0}", err); + } } /// @@ -256,6 +263,7 @@ namespace PepperDash.Essentials.Devices.Displays if (newVal != _PowerIsOn) { _PowerIsOn = newVal; + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Feedback Power State: {0}", _PowerIsOn); PowerIsOnFeedback.FireUpdate(); } } @@ -364,6 +372,8 @@ namespace PepperDash.Essentials.Devices.Displays /// public override void PowerOn() { + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Powering On Display"); + IsPoweringOnIgnorePowerFb = true; //Send(PowerOnCmd); SendBytes(new byte[] { 0xAA, 0x11, 0x00, 0x01, 0x01, 0x00 }); @@ -387,6 +397,8 @@ namespace PepperDash.Essentials.Devices.Displays /// public override void PowerOff() { + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Powering Off Display"); + IsPoweringOnIgnorePowerFb = false; // If a display has unreliable-power off feedback, just override this and // remove this check. diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index a0ed40c9..6585b074 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -113,11 +113,6 @@ - - - - - diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertsEndpointStatusServer.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertsEndpointStatusServer.cs deleted file mode 100644 index 5867b51a..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertsEndpointStatusServer.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using System.Text.RegularExpressions; -using Crestron.SimplSharp.Net.Http; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; - -using Crestron.SimplSharp.CrestronSockets; - - -namespace PepperDash.Essentials.Devices.Common -{ - - /***** - * TODO JTA: Add Polling - * TODO JTA: Move all the registration commnads to the EvertEndpoint class. - * - * - * - * - * - */ - - public class EvertzEndpointStatusServer : Device - { - public IBasicCommunication Communication { get; private set; } - public CommunicationGather PortGather { get; private set; } - public StatusMonitorBase CommunicationMonitor { get; private set; } - public bool isSubscribed; - public string Address; - public GenericUdpServer Server; - - - - /// - /// Shows received lines as hex - /// - public bool ShowHexResponse { get; set; } - public Dictionary Endpoints; - public Dictionary ServerIdByEndpointIp; - - public EvertzEndpointStatusServer(string key, string name, GenericUdpServer server, EvertzEndpointStatusServerPropertiesConfig props) : - base(key, name) - { - Server = server; - Address = props.serverHostname; - Server.DataRecievedExtra += new EventHandler(_Server_DataRecievedExtra); - - Server.Connect(); - Endpoints = new Dictionary(); - - //CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); - } - - - - //TODO JTA: Move this method and process over to the endpoint itself. return a bool. - public bool RegisterEvertzEndpoint (EvertzEndpoint device) - { - - if (Endpoints.ContainsKey(device.Address) == false) - { - Endpoints.Add(device.Address, device); - } - - return true; - } - - - - - void _Server_DataRecievedExtra(object sender, GenericUdpReceiveTextExtraArgs e) - { - Debug.Console(2, this, "_Server_DataRecievedExtra:\nIP:{0}\nPort:{1}\nText{2}\nBytes:{3} ", e.IpAddress, e.Port, e.Text, e.Bytes); - } - - public override bool CustomActivate() - { - /* - Communication.Connect(); - CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); }; - CommunicationMonitor.Start(); - */ - - - - - - return true; - } - - } - - - - - - - - - - - - public class EvertzPortRestResponse - { - public string id; - public string name; - public string type; - public string value; - - } - - public class EvertsStatusRequesstResponse - { - public EvertzStatusDataResponse data; - public string error; - } - - public class EvertzStatusDataResponse - { - public List servers; - } - - public class EvertzServerStatusResponse - { - public string id; - public string name; - public EvertsServerStausNotificationsResponse notify; - - } - public class EvertsServerStausNotificationsResponse - { - public string ip; - public List parameters; - public string port; - public string protocol; - } - public class EvertzEndpointStatusServerPropertiesConfig - { - - public ControlPropertiesConfig control { get; set; } - public string serverHostname { get; set; } - - } - - } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpoint.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpoint.cs deleted file mode 100644 index 7ab504d1..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpoint.cs +++ /dev/null @@ -1,337 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using System.Text.RegularExpressions; -using Crestron.SimplSharp.Net.Http; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - - -namespace PepperDash.Essentials.Devices.Common -{ - - public class EvertzEndpoint : Device - { - - - - public IBasicCommunication Communication { get; private set; } - public CommunicationGather PortGather { get; private set; } - public GenericCommunicationMonitor CommunicationMonitor { get; private set; } - - private GenericHttpClient Client; - public string userName; - public string password; - public string Address; - private bool OnlineStatus; - public BoolFeedback OnlineFeedback; - public IntFeedback PresetFeedback; - - - public bool isSubscribed; - - - - CrestronQueue CommandQueue; - - public Dictionary Ports; - - private string _ControllerKey; - - - private EvertzEndpointStatusServer StatusServer; - private String StatusServerId; - - /// - /// Shows received lines as hex - /// - public bool ShowHexResponse { get; set; } - - public EvertzEndpoint(string key, string name, EvertzEndpointPropertiesConfig props, string type) : - base(key, name) - { - - - this.Address = props.address; - Client = new GenericHttpClient(string.Format("{0}-GenericWebClient", name), string.Format("{0}-GenericWebClient", name), this.Address); - Client.ResponseRecived += new EventHandler(Client_ResponseRecived); - Ports = new Dictionary(); - if (type.ToLower() == "mma10g-trs4k") - { - //create port hdmi 01 - EvertzEndpointPort hdmi1 = new EvertzEndpointPort("HDMI01", "131.0@s", "136.0@s"); - EvertzEndpointPort hdmi2 = new EvertzEndpointPort("HDMI02", "131.1@s", "136.1@s"); - // add to dictionay with all keys - addPortToDictionary(hdmi1); - addPortToDictionary(hdmi2); - } - _ControllerKey = null; - if (props.controllerKey != null) - { - _ControllerKey = props.controllerKey; - } - AddPostActivationAction( () => {PostActivation();}); - CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); - if (props.CommunicationMonitorProperties != null) - { - CommunicationMonitor = new GenericCommunicationMonitor(this, Client, props.CommunicationMonitorProperties); - } - else - { - CommunicationMonitor = new GenericCommunicationMonitor(this, Client, 40000, 120000, 300000, "v.api/apis/EV/SERVERSTATUS"); - } - - - } - - /// - /// Helper method - /// - /// - private void addPortToDictionary(EvertzEndpointPort port) - { - Ports.Add(port.PortName, port); - Ports.Add(port.ResolutionVarID, port); - Ports.Add(port.SyncVarID, port); - //PollForState(port.SyncVarID); - //PollForState(port.ResolutionVarID); - } - - /// - /// - /// - /// - public override bool CustomActivate() - { - - // Create Device -> Constructor fires - // PreActivations get called - // CustomActivate Gets Called Anything that is involved with this single class Ex: Connection, Setup Feedback, Etc. - // After this point all devices are ready for interaction - // PostActivation gets called. Use this for interClass activation. - CommunicationMonitor.Start(); - OnlineFeedback = new BoolFeedback(() => { return OnlineStatus; }); - - - //CrestronConsole.AddNewConsoleCommand(SendLine, "send" + Key, "", ConsoleAccessLevelEnum.AccessOperator); - return true; - } - - /// - /// - /// - private void PostActivation() - { - Debug.Console(2, this, "EvertzEndpoint Post Activation"); - if (_ControllerKey != null) - { - StatusServer = DeviceManager.GetDeviceForKey(_ControllerKey) as EvertzEndpointStatusServer; - StatusServer.RegisterEvertzEndpoint(this); - - // RegisterStatusServer(); - // SendStatusRequest(); - } - // PollAll(); - } - - void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType) - { - if (programEventType == eProgramStatusEventType.Stopping) - { - Debug.Console(1, this, "Program stopping. Disabling EvertzStatusServer"); - if (StatusServerId != null) - { - //UnregisterServer(); - } - } - } - - private void ProcessServerStatusRequest(EvertsStatusRequesstResponse status) - { - // var status = JsonConvert.DeserializeObject(SendStatusRequest()); - if (status.error != null) - { - - } - else if (status.data != null) - { - foreach (var server in status.data.servers) - { - if (server.name == string.Format("{0}-{1}", this.Name, StatusServer.Address)) - { - StatusServerId = server.id; - Debug.Console(2, this, "EvertzEndpoint {0} StatusServer {1} Registered ID {2}", Name, StatusServer.Name, StatusServerId); - /* - - foreach (var port in Ports) - { - // TODO JTA: This needs a better check - // you get a {"status": "success"} or "error": "error to register notification- Variable exists.." - if (!server.notify.parameters.Contains(port.Value.ResolutionVarID)) - { - RegisterForNotification(StatusServerId, port.Value.ResolutionVarID); - } - if (!server.notify.parameters.Contains(port.Value.ResolutionVarID)) - { - RegisterForNotification(StatusServerId, port.Value.SyncVarID); - } - } - */ - - break; - } - } - StatusServerId = null; - } - } - private void RegisterServerWithEndpoint() - { - /* - var registrationResult = RegisterServer(StatusServer.Address, string.Format("{0}-{1}", this.Name, StatusServer.Address), StatusServer.Server.Port.ToString()); - Debug.Console(2, this, "EvertzEndpointStatusServer Registration Result with device {0}\n{1}", Address, registrationResult); - if (registrationResult.Contains("success")) - { - RegisterStatusServer(); - } - else - { - Debug.Console(0, this, "EvertzEndpointStatusServer RegisterServerWithEndpoint with device {0}\n{1}", Address, registrationResult); - - } - * */ - } - - public void PollAll() - { - string collection = ""; - foreach (var parameter in Ports) - { - if (parameter.Key.Contains("@")) - { - collection = collection + parameter.Key + ","; - } - } - collection = collection.Substring(0, collection.Length - 1); - SendGetRequest(collection); - } - public void PollForState(string varId) - { - try - { - SendGetRequest(varId); - //var returnState = JsonConvert.DeserializeObject(SendGetRequest(varId)); - - } - catch (Exception e) - { - Debug.Console(0, this, "PollForState {0}", e); - - } - } - - - public void ProcessGetParameterResponse(EvertzPortRestResponse response) - { - var PortObject = Ports[response.id]; - if (response.name == "Input Status") - { - if (response.value == "Missing") { PortObject.SyncDetected = false; } - else { PortObject.SyncDetected = true; } - } - } - public void SendGetRequest(string s) - { - Client.SendText("v.api/apis/EV/GET/parameter/{0}", s); - } - - public void SendStatusRequest() - { - Client.SendText("/v.api/apis/EV/SERVERSTATUS"); - } - public void RegisterServer(string hostname, string servername, string port) - { - Client.SendText("v.api/apis/EV/SERVERADD/server/{0}/{1}/{2}/udp", hostname, servername, port); - } - public void UnregisterServer() - { - if (StatusServerId != null) - { - Client.SendTextNoResponse("v.api/apis/EV/SERVERDEL/server/{0}", StatusServerId); - } - } - - // TODO JTA: Craete a UnregisterServerFast using DispatchASync. - public void RegisterForNotification(string varId) - { - Client.SendText("v.api/apis/EV/NOTIFYADD/parameter/{0}/{1}", StatusServerId, varId); - } - - - void Client_ResponseRecived(object sender, GenericHttpClientEventArgs e) - { - if (e.Error == HTTP_CALLBACK_ERROR.COMPLETED) - { - if (e.RequestPath.Contains("GET/parameter/")) - { - // Get Parameter response - if (!e.ResponseText.Contains("[")) - ProcessGetParameterResponse(JsonConvert.DeserializeObject(e.ResponseText)); - else if (e.ResponseText.Contains("[")) - { - List test = JsonConvert.DeserializeObject>(e.ResponseText); - foreach (var thing in test) - { - ProcessGetParameterResponse(thing); - } - - } - } - else if (e.RequestPath.Contains("SERVERSTATUS")) - { - PollAll(); - ProcessServerStatusRequest(JsonConvert.DeserializeObject(e.ResponseText)); - } - } - } - - - - - public class EvertzPortsRestResponse - { - List test; - } - public class EvertzPortRestResponse - { - public string id; - public string name; - public string type; - public string value; - - } - - public class EvertzEndpointPort - { - public string PortName; - public string SyncVarID; - public string ResolutionVarID; - public bool SyncDetected; - public string Resolution; - public BoolFeedback SyncDetectedFeedback; - - public EvertzEndpointPort (string portName, string syncVarId, string resolutionVarId) - { - PortName = portName; - SyncVarID = syncVarId; - ResolutionVarID = resolutionVarId; - SyncDetectedFeedback = new BoolFeedback(() => { return SyncDetected; }); - } - - } - - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointPropertiesConfig.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointPropertiesConfig.cs deleted file mode 100644 index 5beff4df..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointPropertiesConfig.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using PepperDash.Core; -using PepperDash.Essentials.Core; - -namespace PepperDash.Essentials.Devices.Common -{ - /// - /// - /// - public class EvertzEndpointPropertiesConfig - { - public CommunicationMonitorConfig CommunicationMonitorProperties { get; set; } - - public ControlPropertiesConfig Control { get; set; } - public string userName { get; set; } - public string password { get; set; } - public string address { get; set; } - public string controllerKey { get; set; } - } - -} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointVarIds.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointVarIds.cs deleted file mode 100644 index fc5200f1..00000000 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Evertz/EvertzEndpointVarIds.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.Devices.Common -{ - public class EvertzEndpointVarIds - { - private string HdmiPort01SyncStatus = "136.0"; - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 98d2e45a..58f97b03 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -107,21 +107,6 @@ namespace PepperDash.Essentials.Devices.Common properties.ToString()); return new DigitalLogger(key, name, props); } - else if (groupName == "evertzendpoint") - { - // var comm = CommFactory.CreateCommForDevice(dc); - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new EvertzEndpoint(key, name, props, typeName); - } - else if (typeName == "evertzendpointstatusserver") - { - var server = CommFactory.CreateCommForDevice(dc) as GenericUdpServer; - - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new EvertzEndpointStatusServer(key, name, server, props); - } else if (typeName == "genericaudiooutwithvolume") { var zone = dc.Properties.Value("zone"); @@ -400,13 +385,6 @@ namespace PepperDash.Essentials.Devices.Common } } - //else if (typeName == "qscdsp") - //{ - // var comm = CommFactory.CreateCommForDevice(dc); - // var props = JsonConvert.DeserializeObject( - // properties.ToString()); - // return new QscDsp(key, name, comm, props); - //} return null; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 372aa232..7f034fbe 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -24,7 +24,11 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy public IntFeedback UltrasonicSensitivityInVacantStateFeedback { get; private set; } - public IntFeedback UltrasonicSensitivityInOccupiedStateFeedback { 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, string name, GlsOdtCCn sensor) @@ -38,11 +42,15 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue); - UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.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); + UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); } /// @@ -52,20 +60,23 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy /// /// protected override void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) - { - 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(); - + { + 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.RawOccupancyPirFeedbackEventId) + RawOccupancyPirFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.RawOccupancyUsFeedbackEventId) + RawOccupancyUsFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInOccupiedStateFeedbackEventId) + UltrasonicSensitivityInOccupiedStateFeedback.FireUpdate(); + else if (args.EventId == GlsOccupancySensorBase.UsSensitivityInVacantStateFeedbackEventId) + UltrasonicSensitivityInVacantStateFeedback.FireUpdate(); base.OccSensor_GlsOccupancySensorChange(device, args); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs index 5003f795..358c63cb 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Power Controllers/Digitallogger.cs @@ -26,7 +26,7 @@ namespace PepperDash.Essentials.Devices.Common public string address; private bool OnlineStatus; public BoolFeedback OnlineFeedback; - private ushort CurrentPreset; + //private ushort CurrentPreset; public IntFeedback PresetFeedback; public Dictionary CircuitStatus; @@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Devices.Common }); CircuitIsCritical[circuit] = new BoolFeedback(() => { - if (CircuitStatus[circuit] != null) + if (CircuitStatus.ContainsKey(circuit)) { return CircuitStatus[circuit].critical; } @@ -114,7 +114,7 @@ namespace PepperDash.Essentials.Devices.Common }); CircuitState[circuit] = new BoolFeedback(() => { - if (CircuitStatus[circuit] != null) + if (CircuitStatus.ContainsKey(circuit)) { return CircuitStatus[circuit].state; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Properties/AssemblyInfo.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Properties/AssemblyInfo.cs index 95a08a40..ccea4891 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Properties/AssemblyInfo.cs @@ -1,7 +1,10 @@ using System.Reflection; +using Crestron.SimplSharp.Reflection; -[assembly: AssemblyTitle("Essentials_Devices_Common")] -[assembly: AssemblyCompany("PepperDash Technology Corp")] -[assembly: AssemblyProduct("Essentials_Devices_Common")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyVersion("1.4.*")] \ No newline at end of file +[assembly: System.Reflection.AssemblyTitle("Essentials_Devices_Common")] +[assembly: System.Reflection.AssemblyCompany("PepperDash Technology Corp")] +[assembly: System.Reflection.AssemblyProduct("PepperDashEssentials")] +[assembly: System.Reflection.AssemblyCopyright("Copyright © PepperDash Technology Corp 2020")] +[assembly: System.Reflection.AssemblyVersion("0.0.0.*")] +[assembly: System.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] +[assembly: Crestron.SimplSharp.Reflection.AssemblyInformationalVersion("0.0.0-buildType-buildNumber")] \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs index 46d171cf..cf4d8530 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/BookingsDataClasses.cs @@ -336,8 +336,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec if(b.Agenda != null) meeting.Agenda = b.Agenda.Value; if(b.Time != null) + { meeting.StartTime = b.Time.StartTime.Value; meeting.EndTime = b.Time.EndTime.Value; + } if(b.Privacy != null) meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index 4d4ad472..84881df3 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -43,8 +43,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public bool CommDebuggingIsOn; - CTimer LoginMessageReceivedTimer; - CTimer RetryConnectionTimer; + //CTimer LoginMessageReceivedTimer; + //CTimer RetryConnectionTimer; /// /// Gets and returns the scaled volume of the codec diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs index 32a8296e..209cfdd9 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoomCamera.cs @@ -47,13 +47,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom private bool isZooming; - private bool isFocusing; + //private bool isFocusing; private bool isMoving { get { - return isPanning || isTilting || isZooming || isFocusing; + return isPanning || isTilting || isZooming; } } diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 2d9c383d..15206840 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 2d9c383db02ef3ef69dee8d42201c746fdfe79ea +Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5