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 74cc4e87..bea29911 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -166,6 +166,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/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/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/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/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/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 e003cd54..62aee267 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -96,7 +96,7 @@ namespace PepperDash.Essentials string directoryPrefix; directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(); - + var version = Crestron.SimplSharp.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Global.SetAssemblyVersion(string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build)); 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/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 371d2213..b7b73cb8 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -119,9 +119,11 @@ + + @@ -153,20 +155,10 @@ + + - - - - - - - - - - - - @@ -201,7 +193,6 @@ - @@ -236,6 +227,18 @@ + + Always + + + Always + + + Always + + + Always + Always 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 0e2792b9..05f0953c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ -# PepperDash Essentials Framework +# PepperDash Essentials Framework (c) 2020 + +## 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 @@ -9,36 +14,31 @@ Essentials Framework is a collection of C# / Simpl# Pro libraries that can be ut - 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 +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 +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. +- 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. +- 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. +- 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, follow this [LINK]() to the Wiki. + For detailed documentation, see the [Wiki](https://github.com/PepperDash/EssentialsFramework/wiki). ## How-To (Getting Started) -To help understand Essentials Framework, we recommend starting with the current [Example Build]() and loading it to a Crestron 3-Series processor. -1. First, load the PepperDashEssentials.cpz to the processor in program slot 1 and start the program. -2. On first boot, the Essentials Application will build the necessary configuration folder structure in the User/Program1/ path. -3. Load the ExampleEssentialsConfigurationFile.json to the User/Program1/ folder. -4. Reset the program via console (progreset -p:1). The program will load the example configuration file. -5. Launch the EssentialsExampleXpanel.vtz project. You can interact with the program (which uses simulated device logic to emulate a real commercial huddle room with presentation, audio and video calling capabilities). -6. Via console, you can run the (**devlist:1**) command to get some insight into what has been loaded from the configuration file into the system . This will print the basic device information in the form of ["key"] "Name". The "key" value is what we can use to interact with each device uniquely. -7. Run the command (**devprops:1 display-1**). This will print the real-time property values of the device with key "display-1". -8. Run the command (**devmethods:1 display-1**). This will print the public methods available for the device with key "display-1". -9. Run the command (**devjson:1 {"deviceKey":"display-1","methodName":"PowerOn", "params": []}**). This will call the method PowerOn() on the device with key "display-1". +See [Getting Started](https://github.com/PepperDash/Essentials/wiki/Get-started#how-to-get-started) 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 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/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/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/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 7aec6a40..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 { @@ -59,6 +60,20 @@ namespace PepperDash.Essentials.Core 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/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 999191ea..4ef68066 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -26,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 /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 23669066..2d7bfc51 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -31,7 +31,9 @@ namespace PepperDash.Essentials.Core } } - + /// + /// Base class for join maps + /// public abstract class JoinMapBase { /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 587159a2..cc3c6d74 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -64,7 +64,7 @@ False - ..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll False @@ -113,11 +113,13 @@ + + @@ -125,6 +127,7 @@ + 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 f9464b7d..5c1f9863 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ [assembly: AssemblyTitle("PepperDashEssentialsBase")] [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentialsBase")] -[assembly: AssemblyCopyright("Copyright © Ppperdash 2019")] +[assembly: AssemblyCopyright("Copyright © Pepperdash 2019")] [assembly: AssemblyVersion("1.4.0.*")] \ 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 DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs index 2a898b19..3b48a0f5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -115,7 +115,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; 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..86003aae 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -122,7 +122,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => { - if (tx.HdmiInput.HdpcSupportOnFeedback.BoolValue) + if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) return 1; else return 0; 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 6f31634d..322cbdab 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -96,6 +96,7 @@ + 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 36c655d2..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 @@ -62,7 +62,6 @@ namespace PepperDash.Essentials.Devices.Common.DSP /// In BiAmp: Instance Tag, QSC: Named Control, Polycom: /// string ControlPointTag { get; } -#warning I dont think index1 and index2 should be a part of the interface. JTA 2018-07-17 int Index1 { get; } int Index2 { get; } bool HasMute { get; } 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 bed83feb..6b57d1ca 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 @@ -112,11 +112,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 004a2579..48179ff1 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"); @@ -395,13 +380,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 e48a5b7b..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].critical != 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].state != null) + if (CircuitStatus.ContainsKey(circuit)) { return CircuitStatus[circuit].state; } 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/ResponseObjects.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs index 3a78c5e0..c603ca08 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs @@ -979,8 +979,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom meeting.StartTime = b.StartTime; if (b.EndTime != null) meeting.EndTime = b.EndTime; - if (b.IsPrivate != null) - meeting.Privacy = b.IsPrivate ? eMeetingPrivacy.Private : eMeetingPrivacy.Public; + + meeting.Privacy = b.IsPrivate ? eMeetingPrivacy.Private : eMeetingPrivacy.Public; // No meeting.Calls data exists for Zoom Rooms. Leaving out for now. 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 acebe6b4..27a665b6 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit acebe6b43b28cc3a93f899e9714292a0cc1ab2cc +Subproject commit 27a665b68a0725729bb09138bb85f575833df4b2