From a870418f961cf50495f23d9f251d40bc7de9985a Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Tue, 22 Jan 2019 12:00:50 -0700 Subject: [PATCH 01/28] Added Ddvc01VtcMessenger; added to bridge; basic functions and feedbacks --- ...vc01Messenger.cs => Ddvc01AtcMessenger.cs} | 29 +- .../Messengers/Ddvc01VtcMessenger.cs | 320 +++++++++++++++++ .../RoomBridges/CotijaDdvc01RoomBridge.cs | 21 +- PepperDashEssentials/Bridges/BridgeBase.cs | 42 +-- .../Bridges/CameraControllerBridge.cs | 330 +++++++++--------- .../Bridges/DigitalLoggerBridge.cs | 134 +++---- .../Bridges/DisplayControllerBridge.cs | 284 +++++++-------- .../Bridges/GenericLightingBridge.cs | 164 ++++----- PepperDashEssentials/ControlSystem.cs | 3 +- .../PepperDashEssentials.csproj | 3 +- essentials-framework | 2 +- 11 files changed, 844 insertions(+), 488 deletions(-) rename PepperDashEssentials/AppServer/Messengers/{AtcDdvc01Messenger.cs => Ddvc01AtcMessenger.cs} (92%) create mode 100644 PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs diff --git a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs similarity index 92% rename from PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs rename to PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs index 8e28d995..b578018b 100644 --- a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs @@ -16,12 +16,33 @@ namespace PepperDash.Essentials.AppServer.Messengers { BasicTriList EISC; + /// + /// 221 + /// const uint BDialHangup = 221; + /// + /// 251 + /// const uint BIncomingAnswer = 251; + /// + /// 252 + /// const uint BIncomingReject = 252; + /// + /// 241 + /// const uint BSpeedDial1 = 241; + /// + /// 242 + /// const uint BSpeedDial2 = 242; + /// + /// 243 + /// const uint BSpeedDial3 = 243; + /// + /// 244 + /// const uint BSpeedDial4 = 244; /// @@ -46,7 +67,7 @@ namespace PepperDash.Essentials.AppServer.Messengers const uint SCallDirection = 222; /// - /// + /// 201-212 0-9*# /// Dictionary DTMFMap = new Dictionary { @@ -64,6 +85,9 @@ namespace PepperDash.Essentials.AppServer.Messengers { "#", 212 }, }; + /// + /// + /// CodecActiveCallItem CurrentCallItem; @@ -160,6 +184,9 @@ namespace PepperDash.Essentials.AppServer.Messengers })); } + /// + /// + /// void SendCallsList() { PostStatusMessage(new diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs new file mode 100644 index 00000000..f79efab5 --- /dev/null +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.EthernetCommunication; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Devices.Common.Codec; + +namespace PepperDash.Essentials.AppServer.Messengers +{ + public class Ddvc01VtcMessenger : MessengerBase + { + BasicTriList EISC; + + /********* Bools *********/ + + /// + /// 724 + /// + const uint BDialHangup = 724; + /// + /// 750 + /// + const uint BCallIncoming = 750; + /// + /// 751 + /// + const uint BIncomingAnswer = 751; + /// + /// 752 + /// + const uint BIncomingReject = 752; + /// + /// 741 + /// + const uint BSpeedDial1 = 741; + /// + /// 742 + /// + const uint BSpeedDial2 = 742; + /// + /// 743 + /// + const uint BSpeedDial3 = 743; + /// + /// 744 + /// + const uint BSpeedDial4 = 744; + /// + /// 800 + /// + const uint BDirectorySearchBusy = 800; + /// + /// 801 when selected entry is a contact + /// + const uint BDirectoryEntryIsContact = 801; + /// + /// 802 To show/hide back button + /// + const uint BDirectoryIsAtTop = 802; + /// + /// 811 + /// + const uint BCameraControlUp = 811; + /// + /// 812 + /// + const uint BCameraControlDown = 812; + /// + /// 813 + /// + const uint BCameraControlLeft = 813; + /// + /// 814 + /// + const uint BCameraControlRight = 814; + /// + /// 815 + /// + const uint BCameraControlZoomIn = 815; + /// + /// 816 + /// + const uint BCameraControlZoomOut = 816; + /// + /// 821 - 826 + /// + const uint BCameraPresetStart = 821; + + /********* Ushorts *********/ + /// + /// 801 + /// + const uint UDirectorySelectRow = 801; + /// + /// 801 + /// + const uint UDirectoryRowCount = 801; + + /********* Strings *********/ + /// + /// 701 + /// + const uint SCurrentDialString = 701; + /// + /// 711 + /// + const uint SCurrentCallNumber = 711; + /// + /// 712 + /// + const uint SCurrentCallName = 712; + /// + /// 731 + /// + const uint SHookState = 731; + /// + /// 722 + /// + const uint SCallDirection = 722; + /// + /// 751 + /// + const uint SIncomingCallName = 751; + /// + /// 752 + /// + const uint SIncomingCallNumber = 752; + /// + /// 800 + /// + const uint SDirectorySearchString = 800; + /// + /// 801-1055 + /// + const uint SDirectoryEntriesStart = 801; + /// + /// 1056 + /// + const uint SDirectoryEntrySelectedName = 1056; + /// + /// 1057 + /// + const uint SDirectoryEntrySelectedNumber = 1057; + + + /// + /// 701-712 0-9*# + /// + Dictionary DTMFMap = new Dictionary + { + { "1", 701 }, + { "2", 702 }, + { "3", 703 }, + { "4", 704 }, + { "5", 705 }, + { "6", 706 }, + { "7", 707 }, + { "8", 708 }, + { "9", 709 }, + { "0", 710 }, + { "*", 711 }, + { "#", 712 }, + }; + + CodecActiveCallItem CurrentCallItem; + CodecActiveCallItem IncomingCallItem; + + + /// + /// + /// + /// + /// + public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath) + : base(key, messagePath) + { + EISC = eisc; + + CurrentCallItem = new CodecActiveCallItem(); + CurrentCallItem.Type = eCodecCallType.Video; + CurrentCallItem.Id = "-video-"; + } + + /// + /// + /// + void SendFullStatus() + { + this.PostStatusMessage(new + { + calls = GetCurrentCallList(), + currentCallString = EISC.GetString(SCurrentCallNumber), + currentDialString = EISC.GetString(SCurrentDialString), + isInCall = EISC.GetString(SHookState) == "Connected", + + }); + } + + /// + /// + /// + /// + protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) + { + EISC.SetStringSigAction(SHookState, s => + { + CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); + SendCallsList(); + }); + + EISC.SetStringSigAction(SCurrentCallNumber, s => + { + CurrentCallItem.Number = s; + SendCallsList(); + }); + + EISC.SetStringSigAction(SCurrentCallName, s => + { + CurrentCallItem.Name = s; + SendCallsList(); + }); + + EISC.SetStringSigAction(SCallDirection, s => + { + CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true); + SendCallsList(); + }); + + EISC.SetBoolSigAction(BCallIncoming, b => + { + if (b) + { + var ica = new CodecActiveCallItem() + { + Direction = eCodecCallDirection.Incoming, + Id = "-video-incoming", + Name = EISC.GetString(SIncomingCallName), + Number = EISC.GetString(SIncomingCallNumber), + Status = eCodecCallStatus.Ringing, + Type = eCodecCallType.Video + }; + IncomingCallItem = ica; + } + else + { + IncomingCallItem = null; + } + SendCallsList(); + }); + + // Add press and holds using helper action + Action addPHAction = (s, u) => + AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); + addPHAction("/cameraUp", BCameraControlUp); + addPHAction("/cameraDown", BCameraControlDown); + addPHAction("/cameraLeft", BCameraControlLeft); + addPHAction("/cameraRight", BCameraControlRight); + addPHAction("/cameraZoomIn", BCameraControlZoomIn); + addPHAction("/cameraZoonOut", BCameraControlZoomOut); + + // Add straight pulse calls using helper action + Action addAction = (s, u) => + AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); + addAction("/endCallById", BDialHangup); + addAction("/acceptById", BIncomingAnswer); + addAction("/rejectById", BIncomingReject); + addAction("/speedDial1", BSpeedDial1); + addAction("/speedDial2", BSpeedDial2); + addAction("/speedDial3", BSpeedDial3); + addAction("/speedDial4", BSpeedDial4); + for(uint i = 0; i < 6; i++) + { + addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i); + } + + // Get status + AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); + // Dial on string + AppServerController.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); + // Pulse DTMF + AppServerController.AddAction(MessagePath + "/dtmf", new Action(s => + { + if (DTMFMap.ContainsKey(s)) + { + EISC.PulseBool(DTMFMap[s], 100); + } + })); + } + + void SendCallsList() + { + PostStatusMessage(new + { + calls = GetCurrentCallList(), + }); + } + + /// + /// Turns the + /// + /// + List GetCurrentCallList() + { + var list = new List(); + if (CurrentCallItem.Status != eCodecCallStatus.Disconnected) + { + list.Add(CurrentCallItem); + } + if (EISC.GetBool(BCallIncoming)) { + + } + return list; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index 55c1f61b..0c1262ad 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -81,6 +81,10 @@ namespace PepperDash.Essentials.Room.Cotija /// 501 /// public const uint ConfigIsReady = 501; + /// + /// 601 + /// + public const uint SourceShareDisableStartJoin = 601; } public class UshortJoin @@ -166,6 +170,7 @@ namespace PepperDash.Essentials.Room.Cotija CotijaDdvc01DeviceBridge SourceBridge; Ddvc01AtcMessenger AtcMessenger; + Ddvc01VtcMessenger VtcMessenger; /// @@ -204,10 +209,14 @@ namespace PepperDash.Essentials.Room.Cotija SetupFunctions(); SetupFeedbacks(); - var key = this.Key + "-" + Parent.Key; - AtcMessenger = new Ddvc01AtcMessenger(key, EISC, "/device/audioCodec"); + var atcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key); + AtcMessenger = new Ddvc01AtcMessenger(atcKey, EISC, "/device/audioCodec"); AtcMessenger.RegisterWithAppServer(Parent); + var vtcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key); + VtcMessenger = new Ddvc01VtcMessenger(vtcKey, EISC, "/device/videoCodec"); + VtcMessenger.RegisterWithAppServer(Parent); + EISC.SigChange += EISC_SigChange; EISC.OnlineStatusChange += (o, a) => { @@ -251,7 +260,6 @@ namespace PepperDash.Essentials.Room.Cotija /// void SetupFunctions() { -#warning need join numbers for these Parent.AddAction(@"/room/room1/promptForCode", new Action(() => EISC.PulseBool(BoolJoin.PromptForCode))); Parent.AddAction(@"/room/room1/clientJoined", new Action(() => EISC.PulseBool(BoolJoin.ClientJoined))); @@ -467,8 +475,8 @@ namespace PepperDash.Essentials.Room.Cotija break; var icon = EISC.StringOutput[651 + i].StringValue; var key = EISC.StringOutput[671 + i].StringValue; - - var type = EISC.StringOutput[701 + i].StringValue; + var type = EISC.StringOutput[BoolJoin.SourceShareDisableStartJoin + i].StringValue; + var disableShare = EISC.BooleanOutput[601 + i].BoolValue; Debug.Console(0, this, "Adding source {0} '{1}'", key, name); var newSLI = new SourceListItem{ @@ -476,7 +484,8 @@ namespace PepperDash.Essentials.Room.Cotija Name = name, Order = (int)i + 1, SourceKey = key, - Type = eSourceListItemType.Route + Type = eSourceListItemType.Route, + DisableCodecSharing = disableShare, }; newSl.Add(key, newSLI); diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index 537b5d59..79f96c71 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -15,7 +15,7 @@ using PepperDash.Essentials.Devices.Common; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.CrestronIO; using PepperDash.Essentials.DM; -using PepperDash.Essentials.Devices.Common.Cameras; +//using PepperDash.Essentials.Devices.Common.Cameras; namespace PepperDash.Essentials.Bridges { @@ -88,16 +88,16 @@ namespace PepperDash.Essentials.Bridges (device as GenericComm).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } - else if (device is CameraBase) - { - (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase) - { - (device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } + //else if (device is CameraBase) + //{ + // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase) + //{ + // (device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} else if (device is DmChassisController) { (device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); @@ -124,16 +124,16 @@ namespace PepperDash.Essentials.Bridges (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } - else if (device is LightingBase) - { - (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } - else if (device is DigitalLogger) - { - (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - continue; - } + //else if (device is LightingBase) + //{ + // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} + //else if (device is DigitalLogger) + //{ + // (device as DigitalLogger).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + // continue; + //} } } diff --git a/PepperDashEssentials/Bridges/CameraControllerBridge.cs b/PepperDashEssentials/Bridges/CameraControllerBridge.cs index 05b67287..a0bdfdd2 100644 --- a/PepperDashEssentials/Bridges/CameraControllerBridge.cs +++ b/PepperDashEssentials/Bridges/CameraControllerBridge.cs @@ -1,187 +1,187 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using Crestron.SimplSharp; +//using Crestron.SimplSharpPro.DeviceSupport; +//using PepperDash.Core; +//using PepperDash.Essentials.Core; +//using PepperDash.Essentials.Devices.Common; -namespace PepperDash.Essentials.Bridges -{ - public static class CameraControllerApiExtensions - { +//namespace PepperDash.Essentials.Bridges +//{ +// public static class CameraControllerApiExtensions +// { - public static BasicTriList _TriList; - public static CameraControllerJoinMap JoinMap; - public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey) - { - JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as CameraControllerJoinMap; +// public static BasicTriList _TriList; +// public static CameraControllerJoinMap JoinMap; +// public static void LinkToApi(this PepperDash.Essentials.Devices.Common.Cameras.CameraBase cameraDevice, BasicTriList trilist, uint joinStart, string joinMapKey) +// { +// JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as CameraControllerJoinMap; - _TriList = trilist; - if (JoinMap == null) - { - JoinMap = new CameraControllerJoinMap(); - } +// _TriList = trilist; +// if (JoinMap == null) +// { +// JoinMap = new CameraControllerJoinMap(); +// } - JoinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString()); +// JoinMap.OffsetJoinNumbers(joinStart); +// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); +// Debug.Console(0, "Linking to Bridge Type {0}", cameraDevice.GetType().Name.ToString()); - var commMonitor = cameraDevice as ICommunicationMonitor; - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); +// var commMonitor = cameraDevice as ICommunicationMonitor; +// commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); - trilist.SetBoolSigAction(JoinMap.Left, (b) => - { - if (b) - { - cameraDevice.PanLeft(); - } - else - { - cameraDevice.Stop(); - } - }); - trilist.SetBoolSigAction(JoinMap.Right, (b) => - { - if (b) - { - cameraDevice.PanRight(); - } - else - { - cameraDevice.Stop(); - } - }); +// trilist.SetBoolSigAction(JoinMap.Left, (b) => +// { +// if (b) +// { +// cameraDevice.PanLeft(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); +// trilist.SetBoolSigAction(JoinMap.Right, (b) => +// { +// if (b) +// { +// cameraDevice.PanRight(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); - trilist.SetBoolSigAction(JoinMap.Up, (b) => - { - if (b) - { - cameraDevice.TiltUp(); - } - else - { - cameraDevice.Stop(); - } - }); - trilist.SetBoolSigAction(JoinMap.Down, (b) => - { - if (b) - { - cameraDevice.TiltDown(); - } - else - { - cameraDevice.Stop(); - } - }); +// trilist.SetBoolSigAction(JoinMap.Up, (b) => +// { +// if (b) +// { +// cameraDevice.TiltUp(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); +// trilist.SetBoolSigAction(JoinMap.Down, (b) => +// { +// if (b) +// { +// cameraDevice.TiltDown(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); - trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) => - { - if (b) - { - cameraDevice.ZoomIn(); - } - else - { - cameraDevice.Stop(); - } - }); +// trilist.SetBoolSigAction(JoinMap.ZoomIn, (b) => +// { +// if (b) +// { +// cameraDevice.ZoomIn(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); - trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) => - { - if (b) - { - cameraDevice.ZoomOut(); - } - else - { - cameraDevice.Stop(); - } - }); +// trilist.SetBoolSigAction(JoinMap.ZoomOut, (b) => +// { +// if (b) +// { +// cameraDevice.ZoomOut(); +// } +// else +// { +// cameraDevice.Stop(); +// } +// }); - if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca") - { - var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca; - trilist.SetSigTrueAction(JoinMap.PowerOn, () => viscaCamera.PowerOn()); - trilist.SetSigTrueAction(JoinMap.PowerOff, () => viscaCamera.PowerOff()); +// if (cameraDevice.GetType().Name.ToString().ToLower() == "cameravisca") +// { +// var viscaCamera = cameraDevice as PepperDash.Essentials.Devices.Common.Cameras.CameraVisca; +// trilist.SetSigTrueAction(JoinMap.PowerOn, () => viscaCamera.PowerOn()); +// trilist.SetSigTrueAction(JoinMap.PowerOff, () => viscaCamera.PowerOff()); - viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); - viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); +// viscaCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); +// viscaCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); - viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); - for (int i = 0; i < JoinMap.NumberOfPresets; i++) - { - int tempNum = i; - trilist.SetSigTrueAction((ushort)(JoinMap.PresetRecallOffset + tempNum), () => - { - viscaCamera.RecallPreset(tempNum); - }); - trilist.SetSigTrueAction((ushort)(JoinMap.PresetSaveOffset + tempNum), () => - { - viscaCamera.SavePreset(tempNum); - }); - } - } +// viscaCamera.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); +// for (int i = 0; i < JoinMap.NumberOfPresets; i++) +// { +// int tempNum = i; +// trilist.SetSigTrueAction((ushort)(JoinMap.PresetRecallOffset + tempNum), () => +// { +// viscaCamera.RecallPreset(tempNum); +// }); +// trilist.SetSigTrueAction((ushort)(JoinMap.PresetSaveOffset + tempNum), () => +// { +// viscaCamera.SavePreset(tempNum); +// }); +// } +// } - } +// } - } - public class CameraControllerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint PowerOff { get; set; } - public uint PowerOn { get; set; } - public uint Up { get; set; } - public uint Down { get; set; } - public uint Left { get; set; } - public uint Right { get; set; } - public uint ZoomIn { get; set; } - public uint ZoomOut { get; set; } - public uint PresetRecallOffset { get; set; } - public uint PresetSaveOffset { get; set; } - public uint NumberOfPresets { get; set; } +// } +// public class CameraControllerJoinMap : JoinMapBase +// { +// public uint IsOnline { get; set; } +// public uint PowerOff { get; set; } +// public uint PowerOn { get; set; } +// public uint Up { get; set; } +// public uint Down { get; set; } +// public uint Left { get; set; } +// public uint Right { get; set; } +// public uint ZoomIn { get; set; } +// public uint ZoomOut { get; set; } +// public uint PresetRecallOffset { get; set; } +// public uint PresetSaveOffset { get; set; } +// public uint NumberOfPresets { get; set; } - public CameraControllerJoinMap() - { - // Digital - IsOnline = 9; - PowerOff = 8; - PowerOn = 7; - Up = 1; - Down = 2; - Left = 3; - Right = 4; - ZoomIn = 5; - ZoomOut = 6; - PresetRecallOffset = 10; - PresetSaveOffset = 30; - NumberOfPresets = 5; - // Analog - } +// public CameraControllerJoinMap() +// { +// // Digital +// IsOnline = 9; +// PowerOff = 8; +// PowerOn = 7; +// Up = 1; +// Down = 2; +// Left = 3; +// Right = 4; +// ZoomIn = 5; +// ZoomOut = 6; +// PresetRecallOffset = 10; +// PresetSaveOffset = 30; +// NumberOfPresets = 5; +// // Analog +// } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; +// public override void OffsetJoinNumbers(uint joinStart) +// { +// var joinOffset = joinStart - 1; - IsOnline = IsOnline + joinOffset; - PowerOff = PowerOff + joinOffset; - PowerOn = PowerOn + joinOffset; - Up = Up + joinOffset; - Down = Down + joinOffset; - Left = Left + joinOffset; - Right = Right + joinOffset; - ZoomIn = ZoomIn + joinOffset; - ZoomOut = ZoomOut + joinOffset; - PresetRecallOffset = PresetRecallOffset + joinOffset; - PresetSaveOffset = PresetSaveOffset + joinOffset; - } - } -} \ No newline at end of file +// IsOnline = IsOnline + joinOffset; +// PowerOff = PowerOff + joinOffset; +// PowerOn = PowerOn + joinOffset; +// Up = Up + joinOffset; +// Down = Down + joinOffset; +// Left = Left + joinOffset; +// Right = Right + joinOffset; +// ZoomIn = ZoomIn + joinOffset; +// ZoomOut = ZoomOut + joinOffset; +// PresetRecallOffset = PresetRecallOffset + joinOffset; +// PresetSaveOffset = PresetSaveOffset + joinOffset; +// } +// } +//} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs b/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs index 1c78b5a0..ef529165 100644 --- a/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs +++ b/PepperDashEssentials/Bridges/DigitalLoggerBridge.cs @@ -1,77 +1,77 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using Crestron.SimplSharp; +//using Crestron.SimplSharpPro.DeviceSupport; +//using PepperDash.Core; +//using PepperDash.Essentials.Core; +//using PepperDash.Essentials.Devices.Common; -namespace PepperDash.Essentials.Bridges -{ - public static class DigitalLoggerApiExtensions - { - public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey) - { - var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DigitalLoggerJoinMap; +//namespace PepperDash.Essentials.Bridges +//{ +// public static class DigitalLoggerApiExtensions +// { +// public static void LinkToApi(this DigitalLogger DigitalLogger, BasicTriList trilist, uint joinStart, string joinMapKey) +// { +// var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DigitalLoggerJoinMap; - if (joinMap == null) - joinMap = new DigitalLoggerJoinMap(); +// if (joinMap == null) +// joinMap = new DigitalLoggerJoinMap(); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - for (uint i = 1; i <= DigitalLogger.CircuitCount; i++) - { - var circuit = i; - DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); - DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); - DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); - trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1)); +// joinMap.OffsetJoinNumbers(joinStart); +// Debug.Console(1, DigitalLogger, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); +// for (uint i = 1; i <= DigitalLogger.CircuitCount; i++) +// { +// var circuit = i; +// DigitalLogger.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); +// DigitalLogger.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); +// DigitalLogger.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); +// trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => DigitalLogger.CycleCircuit(circuit - 1)); +// trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => DigitalLogger.TurnOnCircuit(circuit - 1)); +// trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => DigitalLogger.TurnOffCircuit(circuit - 1)); - } - } - } - public class DigitalLoggerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint CircuitNames { get; set; } - public uint CircuitState { get; set; } - public uint CircuitCycle { get; set; } - public uint CircuitIsCritical { get; set; } - public uint CircuitOnCmd { get; set; } - public uint CircuitOffCmd { get; set; } - public DigitalLoggerJoinMap() - { - // Digital - IsOnline = 9; - CircuitState = 0; - CircuitCycle = 0; - CircuitIsCritical = 10; - CircuitOnCmd = 10; - CircuitOffCmd = 20; - // Serial - CircuitNames = 0; - // Analog - } +// } +// } +// } +// public class DigitalLoggerJoinMap : JoinMapBase +// { +// public uint IsOnline { get; set; } +// public uint CircuitNames { get; set; } +// public uint CircuitState { get; set; } +// public uint CircuitCycle { get; set; } +// public uint CircuitIsCritical { get; set; } +// public uint CircuitOnCmd { get; set; } +// public uint CircuitOffCmd { get; set; } +// public DigitalLoggerJoinMap() +// { +// // Digital +// IsOnline = 9; +// CircuitState = 0; +// CircuitCycle = 0; +// CircuitIsCritical = 10; +// CircuitOnCmd = 10; +// CircuitOffCmd = 20; +// // Serial +// CircuitNames = 0; +// // Analog +// } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; +// public override void OffsetJoinNumbers(uint joinStart) +// { +// var joinOffset = joinStart - 1; - IsOnline = IsOnline + joinOffset; - CircuitNames = CircuitNames + joinOffset; - CircuitState = CircuitState + joinOffset; - CircuitCycle = CircuitCycle + joinOffset; - CircuitIsCritical = CircuitIsCritical + joinOffset; - CircuitOnCmd = CircuitOnCmd + joinOffset; - CircuitOffCmd = CircuitOffCmd + joinOffset; +// IsOnline = IsOnline + joinOffset; +// CircuitNames = CircuitNames + joinOffset; +// CircuitState = CircuitState + joinOffset; +// CircuitCycle = CircuitCycle + joinOffset; +// CircuitIsCritical = CircuitIsCritical + joinOffset; +// CircuitOnCmd = CircuitOnCmd + joinOffset; +// CircuitOffCmd = CircuitOffCmd + joinOffset; - } - } +// } +// } -} \ No newline at end of file +//} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index 8c266589..da91ee87 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -1,171 +1,171 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using Crestron.SimplSharp; +//using Crestron.SimplSharpPro.DeviceSupport; +//using PepperDash.Core; +//using PepperDash.Essentials.Core; +//using PepperDash.Essentials.Devices.Common; -namespace PepperDash.Essentials.Bridges -{ - public static class DisplayControllerApiExtensions - { +//namespace PepperDash.Essentials.Bridges +//{ +// public static class DisplayControllerApiExtensions +// { - public static BasicTriList _TriList; - public static DisplayControllerJoinMap JoinMap; - public static int InputNumber; - public static IntFeedback InputNumberFeedback; - public static List InputKeys = new List(); - public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) - { - JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; - _TriList = trilist; +// public static BasicTriList _TriList; +// public static DisplayControllerJoinMap JoinMap; +// public static int InputNumber; +// public static IntFeedback InputNumberFeedback; +// public static List InputKeys = new List(); +// public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) +// { +// JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; +// _TriList = trilist; - if (JoinMap == null) - { - JoinMap = new DisplayControllerJoinMap(); - } +// if (JoinMap == null) +// { +// JoinMap = new DisplayControllerJoinMap(); +// } - JoinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString()); +// JoinMap.OffsetJoinNumbers(joinStart); +// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); +// Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString()); - trilist.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); +// trilist.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); - InputNumberFeedback = new IntFeedback(() => { return InputNumber;}); - InputNumberFeedback.LinkInputSig(trilist.UShortInput[JoinMap.InputSelect]); - var commMonitor = displayDevice as ICommunicationMonitor; - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); +// InputNumberFeedback = new IntFeedback(() => { return InputNumber;}); +// InputNumberFeedback.LinkInputSig(trilist.UShortInput[JoinMap.InputSelect]); +// var commMonitor = displayDevice as ICommunicationMonitor; +// commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); - // Poewer Off - trilist.SetSigTrueAction(JoinMap.PowerOff, () => - { - InputNumber = 102; - InputNumberFeedback.FireUpdate(); - displayDevice.PowerOff(); - }); +// // Poewer Off +// trilist.SetSigTrueAction(JoinMap.PowerOff, () => +// { +// InputNumber = 102; +// InputNumberFeedback.FireUpdate(); +// displayDevice.PowerOff(); +// }); - displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler(PowerIsOnFeedback_OutputChange); - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); +// displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler(PowerIsOnFeedback_OutputChange); +// displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); - // Poewer On - trilist.SetSigTrueAction(JoinMap.PowerOn, () => - { - InputNumber = 0; - InputNumberFeedback.FireUpdate(); - displayDevice.PowerOn(); - }); +// // Poewer On +// trilist.SetSigTrueAction(JoinMap.PowerOn, () => +// { +// InputNumber = 0; +// InputNumberFeedback.FireUpdate(); +// displayDevice.PowerOn(); +// }); - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); +// displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); - int count = 1; - foreach (var input in displayDevice.InputPorts) - { - InputKeys.Add(input.Key.ToString()); - var tempKey = InputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); - trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); - count++; - } +// int count = 1; +// foreach (var input in displayDevice.InputPorts) +// { +// InputKeys.Add(input.Key.ToString()); +// var tempKey = InputKeys.ElementAt(count - 1); +// trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); +// trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); +// count++; +// } - displayDevice.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => - { - if (a == 0) - { - displayDevice.PowerOff(); - InputNumber = 0; - } - else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber) - { - displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); - InputNumber = a; - } - else if (a == 102) - { - displayDevice.PowerToggle(); +// displayDevice.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); +// trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => +// { +// if (a == 0) +// { +// displayDevice.PowerOff(); +// InputNumber = 0; +// } +// else if (a > 0 && a < displayDevice.InputPorts.Count && a != InputNumber) +// { +// displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); +// InputNumber = a; +// } +// else if (a == 102) +// { +// displayDevice.PowerToggle(); - } - InputNumberFeedback.FireUpdate(); - }); +// } +// InputNumberFeedback.FireUpdate(); +// }); - } +// } - static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e) - { +// static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e) +// { - Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue); +// Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", e.StringValue); - } +// } - static void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) - { +// static void PowerIsOnFeedback_OutputChange(object sender, FeedbackEventArgs e) +// { - // Debug.Console(0, "PowerIsOnFeedback_OutputChange {0}", e.BoolValue); - if (!e.BoolValue) - { - InputNumber = 102; - InputNumberFeedback.FireUpdate(); +// // Debug.Console(0, "PowerIsOnFeedback_OutputChange {0}", e.BoolValue); +// if (!e.BoolValue) +// { +// InputNumber = 102; +// InputNumberFeedback.FireUpdate(); - } - else - { - InputNumber = 0; - InputNumberFeedback.FireUpdate(); - } - } +// } +// else +// { +// InputNumber = 0; +// InputNumberFeedback.FireUpdate(); +// } +// } - } - public class DisplayControllerJoinMap : JoinMapBase - { - public uint Name { get; set; } - public uint InputNamesOffset { get; set; } - public uint InputSelectOffset { get; set; } - public uint IsOnline { get; set; } - public uint PowerOff { get; set; } - public uint InputSelect { get; set; } - public uint PowerOn { get; set; } - public uint SelectScene { get; set; } - public uint LightingSceneOffset { get; set; } - public uint ButtonVisibilityOffset { get; set; } - public uint IntegrationIdSet { get; set; } +// } +// public class DisplayControllerJoinMap : JoinMapBase +// { +// public uint Name { get; set; } +// public uint InputNamesOffset { get; set; } +// public uint InputSelectOffset { get; set; } +// public uint IsOnline { get; set; } +// public uint PowerOff { get; set; } +// public uint InputSelect { get; set; } +// public uint PowerOn { get; set; } +// public uint SelectScene { get; set; } +// public uint LightingSceneOffset { get; set; } +// public uint ButtonVisibilityOffset { get; set; } +// public uint IntegrationIdSet { get; set; } - public DisplayControllerJoinMap() - { - // Digital - IsOnline = 50; - PowerOff = 1; - PowerOn = 2; - InputSelect = 4; - IntegrationIdSet = 1; - LightingSceneOffset = 10; - ButtonVisibilityOffset = 40; - Name = 1; - InputNamesOffset = 10; - InputSelectOffset = 4; - // Analog - } +// public DisplayControllerJoinMap() +// { +// // Digital +// IsOnline = 50; +// PowerOff = 1; +// PowerOn = 2; +// InputSelect = 4; +// IntegrationIdSet = 1; +// LightingSceneOffset = 10; +// ButtonVisibilityOffset = 40; +// Name = 1; +// InputNamesOffset = 10; +// InputSelectOffset = 4; +// // Analog +// } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; +// public override void OffsetJoinNumbers(uint joinStart) +// { +// var joinOffset = joinStart - 1; - IsOnline = IsOnline + joinOffset; - PowerOff = PowerOff + joinOffset; - PowerOn = PowerOn + joinOffset; - SelectScene = SelectScene + joinOffset; - LightingSceneOffset = LightingSceneOffset + joinOffset; - ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; - Name = Name + joinOffset; - InputNamesOffset = InputNamesOffset + joinOffset; - InputSelectOffset = InputSelectOffset + joinOffset; +// IsOnline = IsOnline + joinOffset; +// PowerOff = PowerOff + joinOffset; +// PowerOn = PowerOn + joinOffset; +// SelectScene = SelectScene + joinOffset; +// LightingSceneOffset = LightingSceneOffset + joinOffset; +// ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; +// Name = Name + joinOffset; +// InputNamesOffset = InputNamesOffset + joinOffset; +// InputSelectOffset = InputSelectOffset + joinOffset; - } - } -} \ No newline at end of file +// } +// } +//} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/GenericLightingBridge.cs b/PepperDashEssentials/Bridges/GenericLightingBridge.cs index c93a14fd..be7d88b3 100644 --- a/PepperDashEssentials/Bridges/GenericLightingBridge.cs +++ b/PepperDashEssentials/Bridges/GenericLightingBridge.cs @@ -1,103 +1,103 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using Crestron.SimplSharp; +//using Crestron.SimplSharpPro.DeviceSupport; +//using PepperDash.Core; +//using PepperDash.Essentials.Core; +//using PepperDash.Essentials.Devices.Common; -namespace PepperDash.Essentials.Bridges -{ - public static class GenericLightingApiExtensions - { - public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey) - { - var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericLightingJoinMap; +//namespace PepperDash.Essentials.Bridges +//{ +// public static class GenericLightingApiExtensions +// { +// public static void LinkToApi(this PepperDash.Essentials.Core.Lighting.LightingBase lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey) +// { +// var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as GenericLightingJoinMap; - if (joinMap == null) - joinMap = new GenericLightingJoinMap(); +// if (joinMap == null) +// joinMap = new GenericLightingJoinMap(); - joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); +// joinMap.OffsetJoinNumbers(joinStart); +// Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - Debug.Console(0, "Linking to lighting Type {0}", lightingDevice.GetType().Name.ToString()); +// Debug.Console(0, "Linking to lighting Type {0}", lightingDevice.GetType().Name.ToString()); - // GenericLighitng Actions & FeedBack - trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); +// // GenericLighitng Actions & FeedBack +// trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u])); - int sceneIndex = 1; - foreach (var scene in lightingDevice.LightingScenes) - { - var tempIndex = sceneIndex - 1; - trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex])); - scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]); - trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name; - trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true; - sceneIndex++; - } +// int sceneIndex = 1; +// foreach (var scene in lightingDevice.LightingScenes) +// { +// var tempIndex = sceneIndex - 1; +// trilist.SetSigTrueAction((uint)(joinMap.LightingSceneOffset + sceneIndex), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[tempIndex])); +// scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)]); +// trilist.StringInput[(uint)(joinMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name; +// trilist.BooleanInput[(uint)(joinMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true; +// sceneIndex++; +// } - if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea") - { - var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; - lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s); - } +// if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea") +// { +// var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; +// lutronDevice.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); +// trilist.SetStringSigAction(joinMap.IntegrationIdSet, s => lutronDevice.IntegrationId = s); +// } - //ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; }); +// //ApiEisc.Eisc.SetStringSigAction(ApiMap.integrationID, (s) => { lutronLights.IntegrationId = s; }); - /* - var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; +// /* +// var lutronLights = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea; - for (uint i = 1; i <= lightingBase.CircuitCount; i++) - { - var circuit = i; - lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); - lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); - lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); - trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1)); - trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1)); +// for (uint i = 1; i <= lightingBase.CircuitCount; i++) +// { +// var circuit = i; +// lightingBase.CircuitNameFeedbacks[circuit - 1].LinkInputSig(trilist.StringInput[joinMap.CircuitNames + circuit]); +// lightingBase.CircuitIsCritical[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitIsCritical + circuit]); +// lightingBase.CircuitState[circuit - 1].LinkInputSig(trilist.BooleanInput[joinMap.CircuitState + circuit]); +// trilist.SetSigTrueAction(joinMap.CircuitCycle + circuit, () => lightingBase.CycleCircuit(circuit - 1)); +// trilist.SetSigTrueAction(joinMap.CircuitOnCmd + circuit, () => lightingBase.TurnOnCircuit(circuit - 1)); +// trilist.SetSigTrueAction(joinMap.CircuitOffCmd + circuit, () => lightingBase.TurnOffCircuit(circuit - 1)); - } - */ - } - } - public class GenericLightingJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint SelectScene { get; set; } - public uint LightingSceneOffset { get; set; } - public uint ButtonVisibilityOffset { get; set; } - public uint IntegrationIdSet { get; set; } +// } +// */ +// } +// } +// public class GenericLightingJoinMap : JoinMapBase +// { +// public uint IsOnline { get; set; } +// public uint SelectScene { get; set; } +// public uint LightingSceneOffset { get; set; } +// public uint ButtonVisibilityOffset { get; set; } +// public uint IntegrationIdSet { get; set; } - public GenericLightingJoinMap() - { - // Digital - IsOnline = 1; - SelectScene = 1; - IntegrationIdSet = 1; - LightingSceneOffset = 10; - ButtonVisibilityOffset = 40; - // Analog - } +// public GenericLightingJoinMap() +// { +// // Digital +// IsOnline = 1; +// SelectScene = 1; +// IntegrationIdSet = 1; +// LightingSceneOffset = 10; +// ButtonVisibilityOffset = 40; +// // Analog +// } - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; +// public override void OffsetJoinNumbers(uint joinStart) +// { +// var joinOffset = joinStart - 1; - IsOnline = IsOnline + joinOffset; - SelectScene = SelectScene + joinOffset; - LightingSceneOffset = LightingSceneOffset + joinOffset; - ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; +// IsOnline = IsOnline + joinOffset; +// SelectScene = SelectScene + joinOffset; +// LightingSceneOffset = LightingSceneOffset + joinOffset; +// ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; - } - } -} \ No newline at end of file +// } +// } +//} \ No newline at end of file diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index bd33a276..d943c6a0 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -245,9 +245,8 @@ namespace PepperDash.Essentials /// public void LoadDevices() { -# warning Missing PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); // Build the processor wrapper class - // DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); + DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); // Add global System Monitor device DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index ac74c6c0..10fad395 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -108,8 +108,9 @@ - + + diff --git a/essentials-framework b/essentials-framework index 4cfd0abf..f375395b 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 4cfd0abff1e43577366ad9546eed1600c5303a68 +Subproject commit f375395be26f08348f30472ce9767b1c8a3296aa From 8d03bef34f0a277cc68b149cd494bb00f1c64837 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Thu, 24 Jan 2019 09:20:29 -0700 Subject: [PATCH 02/28] Added missing join constants in Ddvc01RoomBridge --- .../Messengers/Ddvc01VtcMessenger.cs | 64 +++++++++++-- .../RoomBridges/CotijaDdvc01RoomBridge.cs | 90 ++++++++++++++++--- 2 files changed, 136 insertions(+), 18 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index f79efab5..56706b96 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -17,7 +17,6 @@ namespace PepperDash.Essentials.AppServer.Messengers BasicTriList EISC; /********* Bools *********/ - /// /// 724 /// @@ -55,13 +54,21 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint BDirectorySearchBusy = 800; /// + /// 801 + /// + const uint BDirectoryLineSelected = 801; + /// /// 801 when selected entry is a contact /// const uint BDirectoryEntryIsContact = 801; /// /// 802 To show/hide back button /// - const uint BDirectoryIsAtTop = 802; + const uint BDirectoryIsRoot = 802; + /// + /// 803 Pulse from system to inform us when directory is ready + /// + const uint DDirectoryHasChanged = 803; /// /// 811 /// @@ -107,13 +114,13 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint SCurrentDialString = 701; /// - /// 711 + /// 702 /// - const uint SCurrentCallNumber = 711; + const uint SCurrentCallNumber = 702; /// - /// 712 + /// 703 /// - const uint SCurrentCallName = 712; + const uint SCurrentCallName = 703; /// /// 731 /// @@ -170,7 +177,6 @@ namespace PepperDash.Essentials.AppServer.Messengers CodecActiveCallItem CurrentCallItem; CodecActiveCallItem IncomingCallItem; - /// /// /// @@ -253,6 +259,42 @@ namespace PepperDash.Essentials.AppServer.Messengers SendCallsList(); }); + // Directory insanity + EISC.SetUShortSigAction(UDirectoryRowCount, u => + { + var items = new List(); + for (uint i = 0; i < u; i++) + { + var newItem = new + { + name = EISC.GetString(SDirectoryEntriesStart + i), + }; + items.Add(newItem); + } + + var directoryMessage = new { + content = new { + currentDirectory = new { + isRootDirectory = EISC.GetBool(BDirectoryIsRoot), + directoryResults = items + } + } + }; + PostStatusMessage(directoryMessage); + }); + + EISC.SetStringSigAction(SDirectoryEntrySelectedName, s => + { + PostStatusMessage(new { content = new { directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } }); + }); + + EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s => + { + PostStatusMessage(new { content = new { directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } }); + }); + + + // Add press and holds using helper action Action addPHAction = (s, u) => AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); @@ -290,6 +332,14 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.PulseBool(DTMFMap[s], 100); } })); + + // Directory madness + AppServerController.AddAction(MessagePath + "/directorySelectLine", new Action(u => + { + EISC.SetUshort(UDirectorySelectRow, u); + EISC.PulseBool(BDirectoryLineSelected); + })); + } void SendCallsList() diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index 0c1262ad..d1269f2a 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -56,7 +56,10 @@ namespace PepperDash.Essentials.Room.Cotija /// 1 /// public const uint MasterVolumeMuteToggle = 1; - + /// + /// 1 + /// + public const uint VolumeMutesJoinStart = 1; /// /// 61 /// @@ -85,6 +88,7 @@ namespace PepperDash.Essentials.Room.Cotija /// 601 /// public const uint SourceShareDisableStartJoin = 601; + } public class UshortJoin @@ -93,15 +97,26 @@ namespace PepperDash.Essentials.Room.Cotija /// 1 /// public const uint MasterVolumeLevel = 1; - + /// + /// 1 + /// + public const uint VolumeSlidersJoinStart = 1; /// /// 61 /// public const uint ShutdownPromptDuration = 61; + /// + /// 101 + /// + public const uint VolumeSliderCount = 101; } public class StringJoin { + /// + /// 1 + /// + public const uint VolumeSliderNamesJoinStart = 1; /// /// 71 /// @@ -145,6 +160,23 @@ namespace PepperDash.Essentials.Room.Cotija /// 402 /// public const uint ServerUrl = 402; + /// + /// 512 + /// + public const uint RoomSpeedDialNamesJoinStart = 512; + /// + /// 516 + /// + public const uint RoomSpeedDialNumberssJoinStart = 516; + /// + /// 601 + /// + public const uint SourceNameJoinStart = 601; + /// + /// 621 + /// + public const uint SourceIconJoinStart = 621; + } /// @@ -405,7 +437,7 @@ namespace PepperDash.Essentials.Room.Cotija Debug.Console(0, this, "Replacing Room[0] in config"); co.Rooms[0] = rm; } - rm.Name = EISC.StringOutput[501].StringValue; + rm.Name = EISC.StringOutput[StringJoin.ConfigRoomName].StringValue; rm.Key = "room1"; rm.Type = "ddvc01"; @@ -416,15 +448,17 @@ namespace PepperDash.Essentials.Room.Cotija rmProps = JsonConvert.DeserializeObject(rm.Properties.ToString()); rmProps.Help = new EssentialsHelpPropertiesConfig(); - rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue; - rmProps.Help.Message = EISC.StringOutput[502].StringValue; + rmProps.Help.CallButtonText = EISC.StringOutput[StringJoin.ConfigHelpNumber].StringValue; + rmProps.Help.Message = EISC.StringOutput[StringJoin.ConfigHelpMessage].StringValue; rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false - rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue; - rmProps.RoomURI = EISC.StringOutput[505].StringValue; + rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue; + rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue; rmProps.SpeedDials = new List(); // add speed dials as long as there are more - up to 4 + +#warning fix speed dials - 512-515 names, 516-519 numbers for (uint i = 512; i <= 519; i = i + 2) { var num = EISC.StringOutput[i].StringValue; @@ -436,10 +470,10 @@ namespace PepperDash.Essentials.Room.Cotija // This MAY need a check rmProps.AudioCodecKey = "audioCodec"; - rmProps.VideoCodecKey = null; // "videoCodec"; + rmProps.VideoCodecKey = "videoCodec"; // volume control names - var volCount = EISC.UShortOutput[701].UShortValue; + var volCount = EISC.UShortOutput[UshortJoin.VolumeSliderCount].UShortValue; //// use Volumes object or? //rmProps.VolumeSliderNames = new List(); @@ -470,7 +504,7 @@ namespace PepperDash.Essentials.Room.Cotija // add sources... for (uint i = 0; i<= 19; i++) { - var name = EISC.StringOutput[601 + i].StringValue; + var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue; if(string.IsNullOrEmpty(name)) break; var icon = EISC.StringOutput[651 + i].StringValue; @@ -545,7 +579,41 @@ namespace PepperDash.Essentials.Room.Cotija Properties = JToken.FromObject(acProps) }; co.Devices.Add(acConf); - } + } + + if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) + { +#warning Break out these video codec favs + var favs = new List(); + for (uint i = 0; i < 4; i++) + { + if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i)) + { + break; + } + favs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem() + { + Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i), + Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i), + Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio + }); + } + + var props = new + { + favorites = favs + }; + var str = "videoCodec"; + var conf = new DeviceConfig() + { + Group = str, + Key = str, + Name = str, + Type = str, + Properties = JToken.FromObject(props) + }; + co.Devices.Add(conf); + } Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented)); From 530e1ebcb8fd50f21106fe27d1a43b3f24f8094a Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Thu, 24 Jan 2019 11:20:24 -0700 Subject: [PATCH 03/28] Smash system monitor bug --- .../AppServer/CotijaSystemController.cs | 4 +++- .../Messengers/Ddvc01VtcMessenger.cs | 4 +++- .../RoomBridges/CotijaDdvc01RoomBridge.cs | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/PepperDashEssentials/AppServer/CotijaSystemController.cs b/PepperDashEssentials/AppServer/CotijaSystemController.cs index 23af9779..5fd5e958 100644 --- a/PepperDashEssentials/AppServer/CotijaSystemController.cs +++ b/PepperDashEssentials/AppServer/CotijaSystemController.cs @@ -138,7 +138,9 @@ namespace PepperDash.Essentials /// void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType) { - if (programEventType == eProgramStatusEventType.Stopping && WSClient.Connected) + if (programEventType == eProgramStatusEventType.Stopping + && WSClient != null + && WSClient.Connected) { CleanUpWebsocketClient(); } diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index 56706b96..a2c15232 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -203,7 +203,9 @@ namespace PepperDash.Essentials.AppServer.Messengers currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), isInCall = EISC.GetString(SHookState) == "Connected", - + hasDirectory = true, + hasRecents = true, + hasCameras = true }); } diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index d1269f2a..1804fcfa 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -75,7 +75,7 @@ namespace PepperDash.Essentials.Room.Cotija /// /// 72 /// - public const uint SourceHasChanged = 72; + public const uint SourceHasChanged = 71; /// /// 261 - The start of the range of speed dial visibles /// @@ -176,6 +176,15 @@ namespace PepperDash.Essentials.Room.Cotija /// 621 /// public const uint SourceIconJoinStart = 621; + /// + /// 641 + /// + public const uint SourceKeyJoinStart = 641; + /// + /// 661 + /// + public const uint SourceTypeJoinStart = 661; + } @@ -507,10 +516,10 @@ namespace PepperDash.Essentials.Room.Cotija var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue; if(string.IsNullOrEmpty(name)) break; - var icon = EISC.StringOutput[651 + i].StringValue; - var key = EISC.StringOutput[671 + i].StringValue; - var type = EISC.StringOutput[BoolJoin.SourceShareDisableStartJoin + i].StringValue; - var disableShare = EISC.BooleanOutput[601 + i].BoolValue; + var icon = EISC.StringOutput[StringJoin.SourceIconJoinStart + i].StringValue; + var key = EISC.StringOutput[StringJoin.SourceKeyJoinStart + i].StringValue; + var type = EISC.StringOutput[StringJoin.SourceTypeJoinStart + i].StringValue; + var disableShare = EISC.BooleanOutput[BoolJoin.SourceShareDisableStartJoin + i].BoolValue; Debug.Console(0, this, "Adding source {0} '{1}'", key, name); var newSLI = new SourceListItem{ From 8ef58359e7f762ff7a33acc7f70c1a983fc51170 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Sat, 26 Jan 2019 15:54:24 -0700 Subject: [PATCH 04/28] Added directory browsing things for DDVC01 --- .../Messengers/Ddvc01VtcMessenger.cs | 159 ++++++++++++++---- .../Bridges/IBasicCommunicationBridge.cs | 6 +- devjson commands.json | 6 +- 3 files changed, 137 insertions(+), 34 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index a2c15232..f94b9f18 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -70,6 +70,14 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint DDirectoryHasChanged = 803; /// + /// 804 + /// + const uint BDirectoryRoot = 804; + /// + /// 805 + /// + const uint BDirectoryFolderBack = 805; + /// /// 811 /// const uint BCameraControlUp = 811; @@ -116,11 +124,11 @@ namespace PepperDash.Essentials.AppServer.Messengers /// /// 702 /// - const uint SCurrentCallNumber = 702; + const uint SCurrentCallName = 702; /// /// 703 /// - const uint SCurrentCallName = 703; + const uint SCurrentCallNumber = 703; /// /// 731 /// @@ -176,6 +184,7 @@ namespace PepperDash.Essentials.AppServer.Messengers CodecActiveCallItem CurrentCallItem; CodecActiveCallItem IncomingCallItem; + ushort PreviousDirectoryLength = 0; /// /// @@ -209,16 +218,55 @@ namespace PepperDash.Essentials.AppServer.Messengers }); } + void PostDirectory() + { + var u = EISC.GetUshort(UDirectoryRowCount); + var items = new List(); + for (uint i = 0; i < u; i++) + { + var name = EISC.GetString(SDirectoryEntriesStart + i); + var id = (i + 1).ToString(); + // is folder or contact? + if(name.StartsWith("[+]")) + { + items.Add(new + { + folderId = id, + name = name + }); + } + else + { + items.Add(new + { + contactId = id, + name = name + }); + } + } + + var directoryMessage = new + { + currentDirectory = new + { + isRootDirectory = EISC.GetBool(BDirectoryIsRoot), + directoryResults = items + } + }; + PostStatusMessage(directoryMessage); + } + /// /// /// /// protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) { + var asc = appServerController; EISC.SetStringSigAction(SHookState, s => { CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); - SendCallsList(); + SendFullStatus(); // SendCallsList(); }); EISC.SetStringSigAction(SCurrentCallNumber, s => @@ -264,39 +312,30 @@ namespace PepperDash.Essentials.AppServer.Messengers // Directory insanity EISC.SetUShortSigAction(UDirectoryRowCount, u => { - var items = new List(); - for (uint i = 0; i < u; i++) + // The length of the list comes in before the list does. + // Splice the sig change operation onto the last string sig that will be changing + // when the directory entries make it through. + if (PreviousDirectoryLength > 0) { - var newItem = new - { - name = EISC.GetString(SDirectoryEntriesStart + i), - }; - items.Add(newItem); + EISC.ClearStringSigAction(SDirectoryEntriesStart + PreviousDirectoryLength - 1); } - - var directoryMessage = new { - content = new { - currentDirectory = new { - isRootDirectory = EISC.GetBool(BDirectoryIsRoot), - directoryResults = items - } - } - }; - PostStatusMessage(directoryMessage); + EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory()); + PreviousDirectoryLength = u; + //PostDirectory(); }); EISC.SetStringSigAction(SDirectoryEntrySelectedName, s => { - PostStatusMessage(new { content = new { directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } }); + PostStatusMessage(new { content = new { + directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } }); }); EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s => { - PostStatusMessage(new { content = new { directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } }); + PostStatusMessage(new { content = new { + directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } }); }); - - // Add press and holds using helper action Action addPHAction = (s, u) => AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); @@ -310,7 +349,7 @@ namespace PepperDash.Essentials.AppServer.Messengers // Add straight pulse calls using helper action Action addAction = (s, u) => AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); - addAction("/endCallById", BDialHangup); + addAction("/endCallById", BDialHangup); addAction("/acceptById", BIncomingAnswer); addAction("/rejectById", BIncomingReject); addAction("/speedDial1", BSpeedDial1); @@ -322,12 +361,13 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i); } + asc.AddAction(MessagePath + "/isReady", new Action(SendIsReady)); // Get status - AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); + asc.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); // Dial on string - AppServerController.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); + asc.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); // Pulse DTMF - AppServerController.AddAction(MessagePath + "/dtmf", new Action(s => + asc.AddAction(MessagePath + "/dtmf", new Action(s => { if (DTMFMap.ContainsKey(s)) { @@ -336,14 +376,69 @@ namespace PepperDash.Essentials.AppServer.Messengers })); // Directory madness - AppServerController.AddAction(MessagePath + "/directorySelectLine", new Action(u => + asc.AddAction(MessagePath + "/directoryRoot", new Action(() => EISC.PulseBool(BDirectoryRoot))); + asc.AddAction(MessagePath + "/directoryBack", new Action(() => EISC.PulseBool(BDirectoryFolderBack))); + asc.AddAction(MessagePath + "/directoryById", new Action(s => { - EISC.SetUshort(UDirectorySelectRow, u); - EISC.PulseBool(BDirectoryLineSelected); - })); + // the id should contain the line number to forward to simpl + try + { + var u = ushort.Parse(s); + EISC.SetUshort(UDirectorySelectRow, u); + EISC.PulseBool(BDirectoryLineSelected); + } + catch (Exception) + { + Debug.Console(1, this, Debug.ErrorLogLevel.Warning, + "/directoryById request contains non-numeric ID incompatible with DDVC bridge"); + } + })); + asc.AddAction(MessagePath + "/directorySelectContact", new Action(s => + { + try + { + var u = ushort.Parse(s); + EISC.SetUshort(UDirectorySelectRow, u); + EISC.PulseBool(BDirectoryLineSelected); + } + catch + { + + } + })); + asc.AddAction(MessagePath + "/getDirectory", new Action(() => + { + if (EISC.GetUshort(UDirectoryRowCount) > 0) + { + PostDirectory(); + } + else + { + EISC.PulseBool(BDirectoryRoot); + } + })); + //asc.AddAction(MessagePath + "/directorySelectLine", new Action(u => + //{ + // EISC.SetUshort(UDirectorySelectRow, u); + // EISC.PulseBool(BDirectoryLineSelected); + //})); } + /// + /// + /// + void SendIsReady() + { + PostStatusMessage(new + { + isReady = true + }); + } + + /// + /// + /// void SendCallsList() { PostStatusMessage(new diff --git a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs index 8eeed161..d2072a91 100644 --- a/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs +++ b/PepperDashEssentials/Bridges/IBasicCommunicationBridge.cs @@ -30,7 +30,11 @@ namespace PepperDash.Essentials.Bridges Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); // this is a permanent event handler. This cannot be -= from event - comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text); + comm.CommPort.TextReceived += (s, a) => + { + Debug.Console(2, comm, "RX: {0}", a.Text); + trilist.SetString(joinMap.TextReceived, a.Text); + }; trilist.SetStringSigAction(joinMap.SendText, new Action(s => comm.CommPort.SendText(s))); trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action(s => comm.SetPortConfig(s))); diff --git a/devjson commands.json b/devjson commands.json index 6b042a92..4f0aa69e 100644 --- a/devjson commands.json +++ b/devjson commands.json @@ -30,4 +30,8 @@ devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"SetTestValue", "para devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"ClearTestValue", "params": []} -devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]} \ No newline at end of file +devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]} + +devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]} + +devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} \ No newline at end of file From 3c5c157a703318827a2081b315f350dc0f55c672 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 28 Jan 2019 11:09:43 -0700 Subject: [PATCH 05/28] Framework-sub changes --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index f375395b..5bee684b 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit f375395be26f08348f30472ce9767b1c8a3296aa +Subproject commit 5bee684b52588788c392c666126a52c176e03a62 From ffa4de49e98cb911ad8db1e72580d551c3745048 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 28 Jan 2019 16:18:06 -0700 Subject: [PATCH 06/28] Changes default folder to user/programX. Will fail back to nvram/programX if found, otherwise if no default folder found, will create user/programX. --- PepperDashEssentials/ControlSystem.cs | 42 ++++++++++++++++++++------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index d943c6a0..1179a64b 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -93,20 +93,40 @@ namespace PepperDash.Essentials directoryPrefix = Crestron.SimplSharp.CrestronIO.Directory.GetApplicationRootDirectory(); - //directoryPrefix = ""; - - if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) + if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) // Handles 3-series running Windows OS { - filePathPrefix = directoryPrefix + dirSeparator + "NVRAM" - + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString); - } - else - { - filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator; + // Check if User/ProgramX exists + if(Directory.Exists(directoryPrefix + dirSeparator + "User" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) + { + Debug.Console(0, @"User/programX directory found"); + filePathPrefix = directoryPrefix + dirSeparator + "User" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; + } + // Check if Nvram/Programx exists + else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) + { + Debug.Console(0, @"Nvram/programX directory found"); + filePathPrefix = directoryPrefix + dirSeparator + "Nvram" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; + } + // If neither exists, set path to User/ProgramX + else + { + Debug.Console(0, @"No previous directory found. Using User/programX"); + filePathPrefix = directoryPrefix + dirSeparator + "User" + + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; + } + } + else // Handles Linux OS (Virtual Control) + { Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString); + + // Set path to User/ + filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator; } Global.SetFilePathPrefix(filePathPrefix); @@ -164,7 +184,7 @@ namespace PepperDash.Essentials } /// - /// Verifies filesystem is set up. IR, SGD, and program1 folders + /// Verifies filesystem is set up. IR, SGD, and programX folders /// bool SetupFilesystem() { From ca42d744cf60dc060031e7bd2135a4f56543be1d Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Tue, 29 Jan 2019 09:33:01 -0700 Subject: [PATCH 07/28] Directory browsing largely alive for Weil --- .../Messengers/Ddvc01VtcMessenger.cs | 180 ++++++++++++------ 1 file changed, 120 insertions(+), 60 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index f94b9f18..16063b3e 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -78,6 +78,10 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint BDirectoryFolderBack = 805; /// + /// 806 + /// + const uint BDirectoryDialSelectedLine = 806; + /// /// 811 /// const uint BCameraControlUp = 811; @@ -184,8 +188,19 @@ namespace PepperDash.Essentials.AppServer.Messengers CodecActiveCallItem CurrentCallItem; CodecActiveCallItem IncomingCallItem; + ushort PreviousDirectoryLength = 0; + /// + /// For tracking the directory-selected name while waiting for number + /// + string QueuedDirectorySelectedName; + + /// + /// For tracking the directory-selected number while waiting for the name + /// + string QueuedDirectorySelectedNumber; + /// /// /// @@ -201,61 +216,6 @@ namespace PepperDash.Essentials.AppServer.Messengers CurrentCallItem.Id = "-video-"; } - /// - /// - /// - void SendFullStatus() - { - this.PostStatusMessage(new - { - calls = GetCurrentCallList(), - currentCallString = EISC.GetString(SCurrentCallNumber), - currentDialString = EISC.GetString(SCurrentDialString), - isInCall = EISC.GetString(SHookState) == "Connected", - hasDirectory = true, - hasRecents = true, - hasCameras = true - }); - } - - void PostDirectory() - { - var u = EISC.GetUshort(UDirectoryRowCount); - var items = new List(); - for (uint i = 0; i < u; i++) - { - var name = EISC.GetString(SDirectoryEntriesStart + i); - var id = (i + 1).ToString(); - // is folder or contact? - if(name.StartsWith("[+]")) - { - items.Add(new - { - folderId = id, - name = name - }); - } - else - { - items.Add(new - { - contactId = id, - name = name - }); - } - } - - var directoryMessage = new - { - currentDirectory = new - { - isRootDirectory = EISC.GetBool(BDirectoryIsRoot), - directoryResults = items - } - }; - PostStatusMessage(directoryMessage); - } - /// /// /// @@ -321,19 +281,28 @@ namespace PepperDash.Essentials.AppServer.Messengers } EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory()); PreviousDirectoryLength = u; - //PostDirectory(); }); EISC.SetStringSigAction(SDirectoryEntrySelectedName, s => { - PostStatusMessage(new { content = new { - directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } }); + PostStatusMessage(new + { + directoryContactSelected = new + { + name = EISC.GetString(SDirectoryEntrySelectedName), + } + }); }); EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s => { - PostStatusMessage(new { content = new { - directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } }); + PostStatusMessage(new + { + directoryContactSelected = new + { + number = EISC.GetString(SDirectoryEntrySelectedNumber), + } + }); }); // Add press and holds using helper action @@ -407,6 +376,9 @@ namespace PepperDash.Essentials.AppServer.Messengers } })); + asc.AddAction(MessagePath + "/directoryDialContact", new Action(() => { + EISC.PulseBool(BDirectoryDialSelectedLine); + })); asc.AddAction(MessagePath + "/getDirectory", new Action(() => { if (EISC.GetUshort(UDirectoryRowCount) > 0) @@ -425,6 +397,94 @@ namespace PepperDash.Essentials.AppServer.Messengers //})); } + /// + /// + /// + void SendFullStatus() + { + this.PostStatusMessage(new + { + calls = GetCurrentCallList(), + currentCallString = EISC.GetString(SCurrentCallNumber), + currentDialString = EISC.GetString(SCurrentDialString), + directoryContactSelected = new + { + name = EISC.GetString(SDirectoryEntrySelectedName), + number = EISC.GetString(SDirectoryEntrySelectedNumber) + }, + isInCall = EISC.GetString(SHookState) == "Connected", + hasDirectory = true, + hasRecents = true, + hasCameras = true + }); + } + + /// + /// + /// + void PostDirectory() + { + var u = EISC.GetUshort(UDirectoryRowCount); + var items = new List(); + for (uint i = 0; i < u; i++) + { + var name = EISC.GetString(SDirectoryEntriesStart + i); + var id = (i + 1).ToString(); + // is folder or contact? + if (name.StartsWith("[+]")) + { + items.Add(new + { + folderId = id, + name = name + }); + } + else + { + items.Add(new + { + contactId = id, + name = name + }); + } + } + + var directoryMessage = new + { + currentDirectory = new + { + isRootDirectory = EISC.GetBool(BDirectoryIsRoot), + directoryResults = items + } + }; + PostStatusMessage(directoryMessage); + } + + + /// + /// + /// + //void SendDirectorySelectedNameNumberWhenReady() + //{ + // if (!string.IsNullOrEmpty(QueuedDirectorySelectedName) && + // !string.IsNullOrEmpty(QueuedDirectorySelectedNumber)) + // { + // var qName = QueuedDirectorySelectedName; + // var qNum = QueuedDirectorySelectedNumber; + // QueuedDirectorySelectedName = null; + // QueuedDirectorySelectedNumber = null; + // PostStatusMessage(new + // { + // directoryContactSelected = new + // { + // name = qName, + // number = qNum + // } + // }); + + // } + //} + /// /// /// From ef0a8dd3b9e668d48e3d56cf877b41dfa4558088 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Tue, 29 Jan 2019 15:09:45 -0700 Subject: [PATCH 08/28] Don't know, screw this --- .../Messengers/Ddvc01VtcMessenger.cs | 146 ++++++++++++------ 1 file changed, 99 insertions(+), 47 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index 16063b3e..00aceeae 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -110,6 +110,27 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint BCameraPresetStart = 821; + /// + /// 831 + /// + const uint BCameraModeAuto = 831; + /// + /// 832 + /// + const uint BCameraModeManual = 832; + /// + /// 833 + /// + const uint BCameraModeOff = 833; + /// + /// 836 + /// + const uint BCameraNearEnd = 836; + /// + /// 837 + /// + const uint BCameraFarEnd = 837; + /********* Ushorts *********/ /// /// 801 @@ -165,6 +186,10 @@ namespace PepperDash.Essentials.AppServer.Messengers /// 1057 /// const uint SDirectoryEntrySelectedNumber = 1057; + /// + /// 1058 + /// + const uint SDirectorySelectedFolderName = 1058; /// @@ -191,16 +216,6 @@ namespace PepperDash.Essentials.AppServer.Messengers ushort PreviousDirectoryLength = 0; - /// - /// For tracking the directory-selected name while waiting for number - /// - string QueuedDirectorySelectedName; - - /// - /// For tracking the directory-selected number while waiting for the name - /// - string QueuedDirectorySelectedNumber; - /// /// /// @@ -226,25 +241,25 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.SetStringSigAction(SHookState, s => { CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); - SendFullStatus(); // SendCallsList(); + PostFullStatus(); // SendCallsList(); }); EISC.SetStringSigAction(SCurrentCallNumber, s => { CurrentCallItem.Number = s; - SendCallsList(); + PostCallsList(); }); EISC.SetStringSigAction(SCurrentCallName, s => { CurrentCallItem.Name = s; - SendCallsList(); + PostCallsList(); }); EISC.SetStringSigAction(SCallDirection, s => { CurrentCallItem.Direction = (eCodecCallDirection)Enum.Parse(typeof(eCodecCallDirection), s, true); - SendCallsList(); + PostCallsList(); }); EISC.SetBoolSigAction(BCallIncoming, b => @@ -266,7 +281,7 @@ namespace PepperDash.Essentials.AppServer.Messengers { IncomingCallItem = null; } - SendCallsList(); + PostCallsList(); }); // Directory insanity @@ -305,6 +320,18 @@ namespace PepperDash.Essentials.AppServer.Messengers }); }); + EISC.SetStringSigAction(SDirectorySelectedFolderName, s => PostStatusMessage(new + { + directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName) + })); + + EISC.SetSigTrueAction(BCameraModeAuto, () => PostCameraMode()); + EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); + EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); + + EISC.SetSigTrueAction(BCameraNearEnd, PostSelectedCamera); + EISC.SetSigTrueAction(BCameraFarEnd, PostSelectedCamera); + // Add press and holds using helper action Action addPHAction = (s, u) => AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b))); @@ -313,7 +340,7 @@ namespace PepperDash.Essentials.AppServer.Messengers addPHAction("/cameraLeft", BCameraControlLeft); addPHAction("/cameraRight", BCameraControlRight); addPHAction("/cameraZoomIn", BCameraControlZoomIn); - addPHAction("/cameraZoonOut", BCameraControlZoomOut); + addPHAction("/cameraZoomOut", BCameraControlZoomOut); // Add straight pulse calls using helper action Action addAction = (s, u) => @@ -325,14 +352,22 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/speedDial2", BSpeedDial2); addAction("/speedDial3", BSpeedDial3); addAction("/speedDial4", BSpeedDial4); + addAction("/cameraModeAuto", BCameraModeAuto); + addAction("/cameraModeManual", BCameraModeManual); + addAction("/cameraModeOff", BCameraModeOff); + addAction("/cameraFarEnd", BCameraFarEnd); + addAction("/cameraNearEnd", BCameraNearEnd); + + + // camera presets for(uint i = 0; i < 6; i++) { addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i); } - asc.AddAction(MessagePath + "/isReady", new Action(SendIsReady)); + asc.AddAction(MessagePath + "/isReady", new Action(PostIsReady)); // Get status - asc.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); + asc.AddAction(MessagePath + "/fullStatus", new Action(PostFullStatus)); // Dial on string asc.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); // Pulse DTMF @@ -389,22 +424,18 @@ namespace PepperDash.Essentials.AppServer.Messengers { EISC.PulseBool(BDirectoryRoot); } - })); - //asc.AddAction(MessagePath + "/directorySelectLine", new Action(u => - //{ - // EISC.SetUshort(UDirectorySelectRow, u); - // EISC.PulseBool(BDirectoryLineSelected); - //})); + })); } /// /// /// - void SendFullStatus() + void PostFullStatus() { this.PostStatusMessage(new { calls = GetCurrentCallList(), + cameraMode = GetCameraMode(), currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), directoryContactSelected = new @@ -412,10 +443,13 @@ namespace PepperDash.Essentials.AppServer.Messengers name = EISC.GetString(SDirectoryEntrySelectedName), number = EISC.GetString(SDirectoryEntrySelectedNumber) }, + directorySelectedFolderName = EISC.GetString(SDirectorySelectedFolderName), isInCall = EISC.GetString(SHookState) == "Connected", hasDirectory = true, + hasDirectorySearch = false, hasRecents = true, - hasCameras = true + hasCameras = true, + selectedCamera = GetSelectedCamera(), }); } @@ -460,35 +494,53 @@ namespace PepperDash.Essentials.AppServer.Messengers PostStatusMessage(directoryMessage); } + /// + /// + /// + void PostCameraMode() + { + PostStatusMessage(new + { + cameraMode = GetCameraMode() + }); + } /// /// /// - //void SendDirectorySelectedNameNumberWhenReady() - //{ - // if (!string.IsNullOrEmpty(QueuedDirectorySelectedName) && - // !string.IsNullOrEmpty(QueuedDirectorySelectedNumber)) - // { - // var qName = QueuedDirectorySelectedName; - // var qNum = QueuedDirectorySelectedNumber; - // QueuedDirectorySelectedName = null; - // QueuedDirectorySelectedNumber = null; - // PostStatusMessage(new - // { - // directoryContactSelected = new - // { - // name = qName, - // number = qNum - // } - // }); + /// + string GetCameraMode() + { + string m; + if (EISC.GetBool(BCameraModeAuto)) m = "auto"; + else if (EISC.GetBool(BCameraModeManual)) m = "manual"; + else m = "off"; + return m; + } - // } - //} + void PostSelectedCamera() + { + PostStatusMessage(new + { + selectedCamera = GetSelectedCamera() + }); + } /// /// /// - void SendIsReady() + string GetSelectedCamera() + { + string m; + if (EISC.GetBool(BCameraNearEnd)) m = "camera1"; + else m = "cameraFar"; + return m; + } + + /// + /// + /// + void PostIsReady() { PostStatusMessage(new { @@ -499,7 +551,7 @@ namespace PepperDash.Essentials.AppServer.Messengers /// /// /// - void SendCallsList() + void PostCallsList() { PostStatusMessage(new { From bf6971a52de4b66df86ad17e347060a258bc9aa2 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 29 Jan 2019 17:50:46 -0700 Subject: [PATCH 09/28] Adds ability to have configuration filenames with prefixes or suffixes. --- PepperDashEssentials/ControlSystem.cs | 6 +++--- PepperDashEssentials/Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 1179a64b..51856749 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -101,7 +101,7 @@ namespace PepperDash.Essentials if(Directory.Exists(directoryPrefix + dirSeparator + "User" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) { - Debug.Console(0, @"User/programX directory found"); + Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber); filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; } @@ -109,14 +109,14 @@ namespace PepperDash.Essentials else if (Directory.Exists(directoryPrefix + dirSeparator + "Nvram" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) { - Debug.Console(0, @"Nvram/programX directory found"); + Debug.Console(0, @"Nvram/program{0} directory found", InitialParametersClass.ApplicationNumber); filePathPrefix = directoryPrefix + dirSeparator + "Nvram" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; } // If neither exists, set path to User/ProgramX else { - Debug.Console(0, @"No previous directory found. Using User/programX"); + Debug.Console(0, @"No previous directory found. Using User/program{0}", InitialParametersClass.ApplicationNumber); filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; } diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 1f037bfb..97d14f56 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.3.1.*")] +[assembly: AssemblyVersion("1.3.2.*")] diff --git a/essentials-framework b/essentials-framework index 5bee684b..c190321c 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 5bee684b52588788c392c666126a52c176e03a62 +Subproject commit c190321c536c07caae9187e026363c712caac0f7 From e4317825d371e3a0b618f9540bb1be198aa3ab98 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Wed, 30 Jan 2019 17:23:57 -0700 Subject: [PATCH 10/28] Create 'none' source --- .../RoomBridges/CotijaDdvc01RoomBridge.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index 1804fcfa..4b3f30bd 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -510,6 +510,20 @@ namespace PepperDash.Essentials.Room.Cotija co.SourceLists = new Dictionary>(); var newSl = new Dictionary(); + // add "none" source if VTC present + + if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) + { + var codecOsd = new SourceListItem() + { + Name = "None", + IncludeInSourceList = true, + Order = 1, + Type = eSourceListItemType.Route, + SourceKey = "" + }; + newSl.Add("sourceNone", codecOsd); + } // add sources... for (uint i = 0; i<= 19; i++) { @@ -525,7 +539,7 @@ namespace PepperDash.Essentials.Room.Cotija var newSLI = new SourceListItem{ Icon = icon, Name = name, - Order = (int)i + 1, + Order = (int)i + 10, SourceKey = key, Type = eSourceListItemType.Route, DisableCodecSharing = disableShare, From 120dae2e6322a8977c8248d180825cf96377f3fa Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 25 Feb 2019 12:08:35 -0700 Subject: [PATCH 11/28] Changed SourceNone to Source-None --- .../AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index 4b3f30bd..b6c7f7f7 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -522,7 +522,7 @@ namespace PepperDash.Essentials.Room.Cotija Type = eSourceListItemType.Route, SourceKey = "" }; - newSl.Add("sourceNone", codecOsd); + newSl.Add("Source-None", codecOsd); } // add sources... for (uint i = 0; i<= 19; i++) From 59234274dc1f687a0700a5ba581f550209c7cbf8 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 25 Feb 2019 17:51:17 -0700 Subject: [PATCH 12/28] Source-none confirmed; camera selects and FB --- .../Messengers/Ddvc01VtcMessenger.cs | 55 ++++++++++++++----- .../RoomBridges/CotijaDdvc01RoomBridge.cs | 41 ++++++++++++-- 2 files changed, 77 insertions(+), 19 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index 00aceeae..d6f20ab4 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -122,17 +122,15 @@ namespace PepperDash.Essentials.AppServer.Messengers /// 833 /// const uint BCameraModeOff = 833; - /// - /// 836 - /// - const uint BCameraNearEnd = 836; - /// - /// 837 - /// - const uint BCameraFarEnd = 837; + + /********* Ushorts *********/ /// + /// 760 + /// + const uint UCameraNumberSelect = 760; + /// /// 801 /// const uint UDirectorySelectRow = 801; @@ -141,6 +139,8 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint UDirectoryRowCount = 801; + + /********* Strings *********/ /// /// 701 @@ -170,6 +170,7 @@ namespace PepperDash.Essentials.AppServer.Messengers /// 752 /// const uint SIncomingCallNumber = 752; + /// /// 800 /// @@ -329,8 +330,8 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); - EISC.SetSigTrueAction(BCameraNearEnd, PostSelectedCamera); - EISC.SetSigTrueAction(BCameraFarEnd, PostSelectedCamera); + EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera()); + // Add press and holds using helper action Action addPHAction = (s, u) => @@ -355,9 +356,8 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/cameraModeAuto", BCameraModeAuto); addAction("/cameraModeManual", BCameraModeManual); addAction("/cameraModeOff", BCameraModeOff); - addAction("/cameraFarEnd", BCameraFarEnd); - addAction("/cameraNearEnd", BCameraNearEnd); + asc.AddAction("/cameraSelect", new Action(SelectCamera)); // camera presets for(uint i = 0; i < 6; i++) @@ -369,7 +369,8 @@ namespace PepperDash.Essentials.AppServer.Messengers // Get status asc.AddAction(MessagePath + "/fullStatus", new Action(PostFullStatus)); // Dial on string - asc.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); + asc.AddAction(MessagePath + "/dial", new Action(s => + EISC.SetString(SCurrentDialString, s))); // Pulse DTMF asc.AddAction(MessagePath + "/dtmf", new Action(s => { @@ -531,9 +532,16 @@ namespace PepperDash.Essentials.AppServer.Messengers /// string GetSelectedCamera() { + var num = EISC.GetUshort(UCameraNumberSelect); string m; - if (EISC.GetBool(BCameraNearEnd)) m = "camera1"; - else m = "cameraFar"; + if (num == 100) + { + m = "cameraFar"; + } + else + { + m = "camera" + num; + } return m; } @@ -559,6 +567,23 @@ namespace PepperDash.Essentials.AppServer.Messengers }); } + /// + /// + /// + /// + void SelectCamera(string s) + { + var cam = s.Substring(6); + if (cam.ToLower() == "far") + { + EISC.SetUshort(UCameraNumberSelect, 100); + } + else + { + EISC.SetUshort(UCameraNumberSelect, UInt16.Parse(cam)); + } + } + /// /// Turns the /// diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index b6c7f7f7..fdd73989 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -184,8 +184,14 @@ namespace PepperDash.Essentials.Room.Cotija /// 661 /// public const uint SourceTypeJoinStart = 661; - - + /// + /// 761 + /// + public const uint CameraNearNameStart = 761; + /// + /// 770 - presence of this name on the input will cause the camera to be added + /// + public const uint CameraFarName = 770; } /// @@ -525,7 +531,7 @@ namespace PepperDash.Essentials.Room.Cotija newSl.Add("Source-None", codecOsd); } // add sources... - for (uint i = 0; i<= 19; i++) + for (uint i = 0; i <= 19; i++) { var name = EISC.StringOutput[StringJoin.SourceNameJoinStart + i].StringValue; if(string.IsNullOrEmpty(name)) @@ -622,9 +628,36 @@ namespace PepperDash.Essentials.Room.Cotija }); } + + + // cameras + var camsProps = new List(); + for (uint i = 0; i < 9; i++) + { + var name = EISC.GetString(i + StringJoin.CameraNearNameStart); + if (!string.IsNullOrEmpty(name)) + { + camsProps.Add(new + { + name = name, + selector = "camera" + (i + 1), + }); + } + } + var farName = EISC.GetString(StringJoin.CameraFarName); + if (!string.IsNullOrEmpty(farName)) + { + camsProps.Add(new + { + name = farName, + selector = "cameraFar", + }); + } + var props = new { - favorites = favs + favorites = favs, + cameras = camsProps, }; var str = "videoCodec"; var conf = new DeviceConfig() From 7a3ce5fcf1f6998838d1a40bdecd14f9e35d617d Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 4 Mar 2019 11:56:55 -0700 Subject: [PATCH 13/28] Added interface to huddle room to enable volume controls --- PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs | 2 +- essentials-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index c1db1bee..63f0bb29 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -13,7 +13,7 @@ using PepperDash.Essentials.Room.Config; namespace PepperDash.Essentials { - public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute + public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange; diff --git a/essentials-framework b/essentials-framework index c190321c..5bee684b 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit c190321c536c07caae9187e026363c712caac0f7 +Subproject commit 5bee684b52588788c392c666126a52c176e03a62 From 7c88843f500750a48e0d38b9c18fd9e5ee242f3c Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Tue, 5 Mar 2019 10:08:04 -0700 Subject: [PATCH 14/28] Changed one directory message path for mobile control --- .../AppServer/Messengers/VideoCodecBaseMessenger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 5e545aac..bd44e139 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -122,7 +122,7 @@ namespace PepperDash.Essentials.AppServer.Messengers if (call != null) Codec.AcceptCall(call); })); - appServerController.AddAction(MessagePath + "/directoryRoot", new Action(GetDirectoryRoot)); + appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/directoryById", new Action(s => GetDirectory(s))); appServerController.AddAction(MessagePath + "/directorySearch", new Action(s => DirectorySearch(s))); appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory)); From 1c9aa1eaf62274187ac294abeb3b48cb42c0005b Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 5 Mar 2019 11:33:39 -0700 Subject: [PATCH 15/28] Moves setting program initialization value out of InitializeSystem() to SystemMonitorController class --- PepperDashEssentials/ControlSystem.cs | 2 -- essentials-framework | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 51856749..8463390a 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -34,8 +34,6 @@ namespace PepperDash.Essentials /// public override void InitializeSystem() { - SystemMonitor.ProgramInitialization.ProgramInitializationUnderUserControl = true; - DeterminePlatform(); //CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file", diff --git a/essentials-framework b/essentials-framework index 5bee684b..c40f3b40 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 5bee684b52588788c392c666126a52c176e03a62 +Subproject commit c40f3b40d57a82b9191d4f8f6dbf89a4756af4e4 From 24fb74701aafdec29c5b968ebfd37d078988b9d0 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 5 Mar 2019 16:31:13 -0700 Subject: [PATCH 16/28] Working on moving codec browsing data from UI into codec class --- .../Messengers/VideoCodecBaseMessenger.cs | 21 ++++++++++--- .../VC/EssentialsVideoCodecUiDriver.cs | 30 +++++++------------ essentials-framework | 2 +- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index bd44e139..1f3f42b6 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -122,10 +122,23 @@ namespace PepperDash.Essentials.AppServer.Messengers if (call != null) Codec.AcceptCall(call); })); - appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot)); - appServerController.AddAction(MessagePath + "/directoryById", new Action(s => GetDirectory(s))); - appServerController.AddAction(MessagePath + "/directorySearch", new Action(s => DirectorySearch(s))); - appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory)); + + // Directory actions + var dirCodec = Codec as IHasDirectory; + if (dirCodec != null) + { + appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot)); + appServerController.AddAction(MessagePath + "/directoryById", new Action(s => GetDirectory(s))); + appServerController.AddAction(MessagePath + "/directorySearch", new Action(s => DirectorySearch(s))); + } + + // History actions + var recCodec = Codec as IHasCallHistory; + if (recCodec != null) + { + appServerController.AddAction(MessagePath + "/getCallHistory", new Action(GetCallHistory)); + } + appServerController.AddAction(MessagePath + "/privacyModeOn", new Action(Codec.PrivacyModeOn)); appServerController.AddAction(MessagePath + "/privacyModeOff", new Action(Codec.PrivacyModeOff)); appServerController.AddAction(MessagePath + "/privacyModeToggle", new Action(Codec.PrivacyModeToggle)); diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 13bf6a85..998ccbd9 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -61,10 +61,10 @@ namespace PepperDash.Essentials.UIDrivers.VC CodecDirectory CurrentDirectoryResult; - /// - /// Tracks the directory browse history when browsing beyond the root directory - /// - List DirectoryBrowseHistory; + ///// + ///// Tracks the directory browse history when browsing beyond the root directory + ///// + //List DirectoryBrowseHistory; bool NextDirectoryResultIsFolderContents; @@ -532,8 +532,6 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void SetupDirectoryList() { - DirectoryBrowseHistory = new List(); - var codec = Codec as IHasDirectory; if (codec != null) { @@ -558,12 +556,10 @@ namespace PepperDash.Essentials.UIDrivers.VC } /// - /// Sets the current directory resutls to the DirectorRoot and updates Back Button visibiltiy + /// Sets the current directory results to the DirectoryRoot and updates Back Button visibiltiy /// void SetCurrentDirectoryToRoot() { - DirectoryBrowseHistory.Clear(); - CurrentDirectoryResult = (Codec as IHasDirectory).DirectoryRoot; SearchKeypadClear(); @@ -600,7 +596,6 @@ namespace PepperDash.Essentials.UIDrivers.VC if (NextDirectoryResultIsFolderContents) { NextDirectoryResultIsFolderContents = false; - DirectoryBrowseHistory.Add(e.Directory); } CurrentDirectoryResult = e.Directory; DirectoryBackButtonVisibleFeedback.FireUpdate(); @@ -625,18 +620,13 @@ namespace PepperDash.Essentials.UIDrivers.VC { var codec = Codec as IHasDirectory; - if (DirectoryBrowseHistory.Count > 0) + if (codec != null) { - var lastItemIndex = DirectoryBrowseHistory.Count - 1; - CurrentDirectoryResult = DirectoryBrowseHistory[lastItemIndex]; - DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]); + CurrentDirectoryResult = codec.GetDirectoryParentFolderContents(); RefreshDirectory(); } - else - { - SetCurrentDirectoryToRoot(); - } + } /// @@ -725,13 +715,13 @@ namespace PepperDash.Essentials.UIDrivers.VC Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = ""; Parent.MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Connect"; Parent.MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = true; - var cc = c; // lambda scope + var cc = c; // to maintian lambda scope Parent.MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() => { Parent.PopupInterlock.Hide(); var codec = Codec as VideoCodecBase; if (codec != null) - codec.Dial(c.Number); + codec.Dial(cc.Number); }); } Parent.MeetingOrContactMethodModalSrl.Count = i; diff --git a/essentials-framework b/essentials-framework index c40f3b40..d869bc92 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit c40f3b40d57a82b9191d4f8f6dbf89a4756af4e4 +Subproject commit d869bc92ce177a79dcc3c3e3f385246fca7692d7 From 84ee743ff5199c1186398a0a7339117f73bf5468 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 6 Mar 2019 16:33:00 -0700 Subject: [PATCH 17/28] Moved Directory browsing logic from VideoCodecUiDriver down to IHasDirectory Interface to sync better with VideoCodecBaseMessenger for MC --- .../AppServer/CotijaSystemController.cs | 10 +++--- .../Room/Types/EssentialsHuddleVtc1Room.cs | 2 +- .../VC/EssentialsVideoCodecUiDriver.cs | 32 +++++++------------ essentials-framework | 2 +- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/PepperDashEssentials/AppServer/CotijaSystemController.cs b/PepperDashEssentials/AppServer/CotijaSystemController.cs index 5fd5e958..4417debf 100644 --- a/PepperDashEssentials/AppServer/CotijaSystemController.cs +++ b/PepperDashEssentials/AppServer/CotijaSystemController.cs @@ -317,10 +317,12 @@ namespace PepperDash.Essentials CrestronConsole.ConsoleCommandResponse(@"Mobile Control Information: Server address: {0} System Name: {1} - System UUID: {2} - System User code: {3} - Connected?: {4} - Seconds Since Last Ack: {5}", url, name, SystemUuid, + System URL: {2} + System UUID: {3} + System User code: {4} + Connected?: {5} + Seconds Since Last Ack: {6}" + , url, name, ConfigReader.ConfigObject.SystemUrl, SystemUuid, code, conn, secSinceLastAck.Seconds); } diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 62b11e49..2c5ca160 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -279,7 +279,7 @@ namespace PepperDash.Essentials inAudioCall = AudioCodec.IsInCall; if(VideoCodec != null) - inVideoCall = AudioCodec.IsInCall; + inVideoCall = VideoCodec.IsInCall; if (inAudioCall || inVideoCall) return true; diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 998ccbd9..17eb18b6 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -59,7 +59,7 @@ namespace PepperDash.Essentials.UIDrivers.VC SmartObjectDynamicList DirectoryList; - CodecDirectory CurrentDirectoryResult; + //CodecDirectory CurrentDirectoryResult; ///// ///// Tracks the directory browse history when browsing beyond the root directory @@ -174,7 +174,7 @@ namespace PepperDash.Essentials.UIDrivers.VC triList.SetSigFalseAction(UIBoolJoin.VCDirectoryBackPress, GetDirectoryParentFolderContents); - DirectoryBackButtonVisibleFeedback = new BoolFeedback(() => CurrentDirectoryResult != (codec as IHasDirectory).DirectoryRoot); + DirectoryBackButtonVisibleFeedback = (codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot; DirectoryBackButtonVisibleFeedback .LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackVisible]); @@ -546,12 +546,8 @@ namespace PepperDash.Essentials.UIDrivers.VC codec.PhonebookSyncState.InitialSyncCompleted += new EventHandler(PhonebookSyncState_InitialSyncCompleted); } - - // If there is something here now, show it otherwise wait for the event - if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0) - { - RefreshDirectory(); - } + RefreshDirectory(); + } } @@ -560,12 +556,10 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void SetCurrentDirectoryToRoot() { - CurrentDirectoryResult = (Codec as IHasDirectory).DirectoryRoot; + (Codec as IHasDirectory).SetCurrentDirectoryToRoot(); SearchKeypadClear(); - DirectoryBackButtonVisibleFeedback.FireUpdate(); - RefreshDirectory(); } @@ -580,10 +574,8 @@ namespace PepperDash.Essentials.UIDrivers.VC SetCurrentDirectoryToRoot(); - if (CurrentDirectoryResult != null && codec.DirectoryRoot.DirectoryResults.Count > 0) - { - RefreshDirectory(); - } + RefreshDirectory(); + } /// @@ -597,8 +589,6 @@ namespace PepperDash.Essentials.UIDrivers.VC { NextDirectoryResultIsFolderContents = false; } - CurrentDirectoryResult = e.Directory; - DirectoryBackButtonVisibleFeedback.FireUpdate(); RefreshDirectory(); } @@ -622,7 +612,7 @@ namespace PepperDash.Essentials.UIDrivers.VC if (codec != null) { - CurrentDirectoryResult = codec.GetDirectoryParentFolderContents(); + codec.GetDirectoryParentFolderContents(); RefreshDirectory(); } @@ -635,10 +625,10 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void RefreshDirectory() { - if (CurrentDirectoryResult.DirectoryResults.Count > 0) + if ((Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults.Count > 0) { ushort i = 0; - foreach (var r in CurrentDirectoryResult.DirectoryResults) + foreach (var r in (Codec as IHasDirectory).CurrentDirectoryResult.CurrentDirectoryResults) { if (i == DirectoryList.MaxCount) { @@ -1092,7 +1082,7 @@ namespace PepperDash.Essentials.UIDrivers.VC SearchStringFeedback.FireUpdate(); SearchStringKeypadCheckEnables(); - if(CurrentDirectoryResult != (Codec as IHasDirectory).DirectoryRoot) + if((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) SetCurrentDirectoryToRoot(); } diff --git a/essentials-framework b/essentials-framework index d869bc92..efa39eb6 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit d869bc92ce177a79dcc3c3e3f385246fca7692d7 +Subproject commit efa39eb6fd171fc53c163a8d348d5af47bc5ccf0 From 52ac57c080fac908d67d5c929a51838b54e37f2b Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 7 Mar 2019 15:20:24 -0700 Subject: [PATCH 18/28] fixed vc directory browsing to properly sync between MC and Essentials UIs --- .../Messengers/VideoCodecBaseMessenger.cs | 53 ++++++++++++++++--- .../VC/EssentialsVideoCodecUiDriver.cs | 18 ++----- essentials-framework | 2 +- 3 files changed, 49 insertions(+), 24 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index 1f3f42b6..eb56c01e 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -40,6 +40,7 @@ namespace PepperDash.Essentials.AppServer.Messengers if (dirCodec != null) { dirCodec.DirectoryResultReturned += new EventHandler(dirCodec_DirectoryResultReturned); + } var recCodec = codec as IHasCallHistory; @@ -74,12 +75,30 @@ namespace PepperDash.Essentials.AppServer.Messengers /// void dirCodec_DirectoryResultReturned(object sender, DirectoryEventArgs e) { - PostStatusMessage(new - { - currentDirectory = e.Directory - }); + SendDirectory((Codec as IHasDirectory).CurrentDirectoryResult, e.DirectoryIsOnRoot); } + /// + /// Posts the current directory + /// + void SendDirectory(CodecDirectory directory, bool isRoot) + { + var dirCodec = Codec as IHasDirectory; + + if (dirCodec != null) + { + var directoryMessage = new + { + currentDirectory = new + { + directoryResults = directory.CurrentDirectoryResults, + isRootDirectory = isRoot + } + }; + PostStatusMessage(directoryMessage); + } + } + /// /// /// @@ -130,6 +149,7 @@ namespace PepperDash.Essentials.AppServer.Messengers appServerController.AddAction(MessagePath + "/getDirectory", new Action(GetDirectoryRoot)); appServerController.AddAction(MessagePath + "/directoryById", new Action(s => GetDirectory(s))); appServerController.AddAction(MessagePath + "/directorySearch", new Action(s => DirectorySearch(s))); + appServerController.AddAction(MessagePath + "/directoryBack", new Action(GetPreviousDirectory)); } // History actions @@ -228,12 +248,28 @@ namespace PepperDash.Essentials.AppServer.Messengers return; } - PostStatusMessage(new - { - currentDirectory = dirCodec.DirectoryRoot - }); + dirCodec.SetCurrentDirectoryToRoot(); + + //PostStatusMessage(new + //{ + // currentDirectory = dirCodec.DirectoryRoot + //}); } + /// + /// Requests the parent folder contents + /// + void GetPreviousDirectory() + { + var dirCodec = Codec as IHasDirectory; + if (dirCodec == null) + { + return; + } + + dirCodec.GetDirectoryParentFolderContents(); + } + /// /// Handler for codec changes /// @@ -284,6 +320,7 @@ namespace PepperDash.Essentials.AppServer.Messengers }, showSelfViewByDefault = Codec.ShowSelfViewByDefault, hasDirectory = Codec is IHasDirectory, + hasDirectorySearch = true, hasRecents = Codec is IHasCallHistory, hasCameras = Codec is IHasCameraControl }); diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 17eb18b6..c9a2ae12 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -58,16 +58,7 @@ namespace PepperDash.Essentials.UIDrivers.VC SmartObjectDynamicList RecentCallsList; SmartObjectDynamicList DirectoryList; - - //CodecDirectory CurrentDirectoryResult; - - ///// - ///// Tracks the directory browse history when browsing beyond the root directory - ///// - //List DirectoryBrowseHistory; - bool NextDirectoryResultIsFolderContents; - BoolFeedback DirectoryBackButtonVisibleFeedback; // These are likely temp until we get a keyboard built @@ -558,6 +549,7 @@ namespace PepperDash.Essentials.UIDrivers.VC { (Codec as IHasDirectory).SetCurrentDirectoryToRoot(); +#warning Deal with this recursive issue SearchKeypadClear(); RefreshDirectory(); @@ -585,10 +577,7 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void dir_DirectoryResultReturned(object sender, DirectoryEventArgs e) { - if (NextDirectoryResultIsFolderContents) - { - NextDirectoryResultIsFolderContents = false; - } + RefreshDirectory(); } @@ -600,7 +589,6 @@ namespace PepperDash.Essentials.UIDrivers.VC { (Codec as IHasDirectory).GetDirectoryFolderContents(folder.FolderId); - NextDirectoryResultIsFolderContents = true; } /// @@ -614,7 +602,7 @@ namespace PepperDash.Essentials.UIDrivers.VC { codec.GetDirectoryParentFolderContents(); - RefreshDirectory(); + //RefreshDirectory(); } } diff --git a/essentials-framework b/essentials-framework index efa39eb6..3e7dbeb1 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit efa39eb6fd171fc53c163a8d348d5af47bc5ccf0 +Subproject commit 3e7dbeb111513cfed55db5012375bec1de7239a1 From 3a99c3bb304e1f9f4830ae7c84fd9594f3fd8c85 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 7 Mar 2019 16:31:56 -0700 Subject: [PATCH 19/28] Adds PrefixDictionaryFolderItems method to add "[+] " prefix to folder names for MC. --- .../Messengers/VideoCodecBaseMessenger.cs | 45 ++++++++++++++++++- .../VC/EssentialsVideoCodecUiDriver.cs | 1 - essentials-framework | 2 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index eb56c01e..b8ca2dac 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -87,11 +87,13 @@ namespace PepperDash.Essentials.AppServer.Messengers if (dirCodec != null) { + var prefixedDirectoryResults = PrefixDirectoryFolderItems(directory); + var directoryMessage = new { currentDirectory = new { - directoryResults = directory.CurrentDirectoryResults, + directoryResults = prefixedDirectoryResults, isRootDirectory = isRoot } }; @@ -99,6 +101,47 @@ namespace PepperDash.Essentials.AppServer.Messengers } } + /// + /// Iterates a directory object and prefixes any folder items with "[+] " + /// + /// + /// + List PrefixDirectoryFolderItems (CodecDirectory directory) + { + var tempDirectoryList = new List(); + + if (directory.CurrentDirectoryResults.Count > 0) + { + foreach (var item in directory.CurrentDirectoryResults) + { + if (item is DirectoryFolder) + { + var newFolder = new DirectoryFolder(); + + newFolder = (DirectoryFolder)item.Clone(); + + string prefixName = "[+] " + newFolder.Name; + + newFolder.Name = prefixName; + + tempDirectoryList.Add(newFolder); + } + else + { + tempDirectoryList.Add(item); + } + } + } + //else + //{ + // DirectoryItem noResults = new DirectoryItem() { Name = "No Results Found" }; + + // tempDirectoryList.Add(noResults); + //} + + return tempDirectoryList; + } + /// /// /// diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index c9a2ae12..15f90ff4 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -549,7 +549,6 @@ namespace PepperDash.Essentials.UIDrivers.VC { (Codec as IHasDirectory).SetCurrentDirectoryToRoot(); -#warning Deal with this recursive issue SearchKeypadClear(); RefreshDirectory(); diff --git a/essentials-framework b/essentials-framework index 3e7dbeb1..713be9a7 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 3e7dbeb111513cfed55db5012375bec1de7239a1 +Subproject commit 713be9a794efcb48043ed784b214f11cf21e145c From 2121456d50d2883e33e718d69e40f81b34bb2e60 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 8 Mar 2019 16:56:37 -0700 Subject: [PATCH 20/28] Adds fake directory to MockVC with full features --- ...ssentialsHuddleVtc1PanelAvFunctionsDriver.cs | 5 ++++- .../VC/EssentialsVideoCodecUiDriver.cs | 17 ++++++++++++----- essentials-framework | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 4b1f2188..be51a4aa 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -927,7 +927,10 @@ namespace PepperDash.Essentials _CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange; RefreshSourceInfo(); - (_CurrentRoom.VideoCodec as IHasScheduleAwareness).CodecSchedule.MeetingsListHasChanged += CodecSchedule_MeetingsListHasChanged; + if (_CurrentRoom.VideoCodec is IHasScheduleAwareness) + { + (_CurrentRoom.VideoCodec as IHasScheduleAwareness).CodecSchedule.MeetingsListHasChanged += CodecSchedule_MeetingsListHasChanged; + } CallSharingInfoVisibleFeedback = new BoolFeedback(() => _CurrentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue); _CurrentRoom.VideoCodec.SharingContentIsOnFeedback.OutputChange += SharingContentIsOnFeedback_OutputChange; diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 15f90ff4..b035523e 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -1065,12 +1065,19 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void SearchKeypadClear() { - SearchStringBuilder.Remove(0, SearchStringBuilder.Length); - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); + try + { + SearchStringBuilder.Remove(0, SearchStringBuilder.Length); + SearchStringFeedback.FireUpdate(); + SearchStringKeypadCheckEnables(); - if((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) - SetCurrentDirectoryToRoot(); + if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) + SetCurrentDirectoryToRoot(); + } + catch (Exception e) + { + Debug.Console(1, "SearchKeypadClear() blew up!: {0}", e); + } } /// diff --git a/essentials-framework b/essentials-framework index 713be9a7..1a61f2b4 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 713be9a794efcb48043ed784b214f11cf21e145c +Subproject commit 1a61f2b4886bab143b71ce97cf29fe0e8ec0647e From 038e23289eeb1d37275de3863687ea42b2df31fb Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 12 Mar 2019 11:08:32 -0600 Subject: [PATCH 21/28] Adds inital ConfigMessenger --- .../AppServer/Messengers/ConfigMessenger.cs | 12 ++++++++++++ essentials-framework | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs diff --git a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs new file mode 100644 index 00000000..e4fd18fe --- /dev/null +++ b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.AppServer.Messengers +{ + public class ConfigMessenger + { + } +} \ No newline at end of file diff --git a/essentials-framework b/essentials-framework index 1a61f2b4..ea76dcbe 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 1a61f2b4886bab143b71ce97cf29fe0e8ec0647e +Subproject commit ea76dcbe5b8eb08f53e3047ba0516915140c7db1 From 43fd263ea1d6f865e7aaec928eaf6f5c63403487 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 13 Mar 2019 16:33:51 -0600 Subject: [PATCH 22/28] Config Update Working --- .../AppServer/CotijaSystemController.cs | 13 ++++- .../AppServer/Messengers/ConfigMessenger.cs | 47 ++++++++++++++++++- .../CotijaEssentialsHuddleSpaceRoomBridge.cs | 1 + .../PepperDashEssentials.csproj | 1 + .../VC/EssentialsVideoCodecUiDriver.cs | 20 +++----- 5 files changed, 66 insertions(+), 16 deletions(-) diff --git a/PepperDashEssentials/AppServer/CotijaSystemController.cs b/PepperDashEssentials/AppServer/CotijaSystemController.cs index 4417debf..44b007ef 100644 --- a/PepperDashEssentials/AppServer/CotijaSystemController.cs +++ b/PepperDashEssentials/AppServer/CotijaSystemController.cs @@ -17,6 +17,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Room.Cotija; +using PepperDash.Essentials.AppServer.Messengers; namespace PepperDash.Essentials { @@ -39,6 +40,8 @@ namespace PepperDash.Essentials Dictionary PushedActions = new Dictionary(); + public ConfigMessenger ConfigMessenger { get; private set; } + CTimer ServerHeartbeatCheckTimer; long ServerHeartbeatInterval = 20000; @@ -49,7 +52,7 @@ namespace PepperDash.Essentials DateTime LastAckMessage; - string SystemUuid; + public string SystemUuid; List RoomBridges = new List(); @@ -97,9 +100,15 @@ namespace PepperDash.Essentials CrestronConsole.AddNewConsoleCommand(s => CleanUpWebsocketClient(), "mobiledisco", "Disconnects websocket", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => ParseStreamRx(s), "mobilesimulateaction", "Simulates a message from the server", ConsoleAccessLevelEnum.AccessOperator); + CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler); - + + // Config Messenger + var cmKey = Key + "-config"; + ConfigMessenger = new ConfigMessenger(cmKey, "/config"); + ConfigMessenger.RegisterWithAppServer(this); } /// diff --git a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs index e4fd18fe..549bf17b 100644 --- a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs @@ -4,9 +4,54 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + namespace PepperDash.Essentials.AppServer.Messengers { - public class ConfigMessenger + + /// + /// Handles interactions with the app server to update the config + /// + public class ConfigMessenger : MessengerBase { + public ConfigMessenger(string key, string messagePath) + : base(key, messagePath) + { + ConfigUpdater.ConfigStatusChanged -= ConfigUpdater_ConfigStatusChanged; + ConfigUpdater.ConfigStatusChanged += new EventHandler(ConfigUpdater_ConfigStatusChanged); + } + + void ConfigUpdater_ConfigStatusChanged(object sender, ConfigStatusEventArgs e) + { + PostUpdateStatus(e.UpdateStatus.ToString()); + } + + protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController) + { + appServerController.AddAction(MessagePath + "/updateConfig", new Action(s => GetConfigFile(s))); + } + + void GetConfigFile(string url) + { + url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid); + + ConfigUpdater.GetConfigFromServer(url); + } + + /// + /// Posts a message with the current status of the config update + /// + /// + void PostUpdateStatus(string status) + { + PostStatusMessage(new + { + updateStatus = status + }); + } + } + + } \ No newline at end of file diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 976cb484..eef8e167 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -25,6 +25,7 @@ namespace PepperDash.Essentials public AudioCodecBaseMessenger ACMessenger { get; private set; } + /// /// /// diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 10fad395..a4072766 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -108,6 +108,7 @@ + diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index b035523e..704a42d3 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -102,7 +102,6 @@ namespace PepperDash.Essentials.UIDrivers.VC SetupCallStagingPopover(); SetupDialKeypad(); ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5); - SetupDirectoryList(); SetupRecentCallsList(); SetupFavorites(); SetupLayoutControls(); @@ -160,6 +159,8 @@ namespace PepperDash.Essentials.UIDrivers.VC }); SearchStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.CodecDirectorySearchEntryText]); + SetupDirectoryList(); + SearchStringBackspaceVisibleFeedback = new BoolFeedback(() => SearchStringBuilder.Length > 0); SearchStringBackspaceVisibleFeedback.LinkInputSig(triList.BooleanInput[UIBoolJoin.VCDirectoryBackspaceVisible]); @@ -1065,19 +1066,12 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void SearchKeypadClear() { - try - { - SearchStringBuilder.Remove(0, SearchStringBuilder.Length); - SearchStringFeedback.FireUpdate(); - SearchStringKeypadCheckEnables(); + SearchStringBuilder.Remove(0, SearchStringBuilder.Length); + SearchStringFeedback.FireUpdate(); + SearchStringKeypadCheckEnables(); - if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) - SetCurrentDirectoryToRoot(); - } - catch (Exception e) - { - Debug.Console(1, "SearchKeypadClear() blew up!: {0}", e); - } + if ((Codec as IHasDirectory).CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) + SetCurrentDirectoryToRoot(); } /// From 90bbd65fdc73d967702679a694b8d6c06e7404f3 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 14 Mar 2019 10:41:07 -0600 Subject: [PATCH 23/28] Add lastest essentials framework --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index ea76dcbe..e1f26dc6 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit ea76dcbe5b8eb08f53e3047ba0516915140c7db1 +Subproject commit e1f26dc6e005cf4cd2e2401564dfb61b504f6b72 From 6235b44d8927cd6229ba380d22e5229298efcfa8 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 15 Mar 2019 12:16:01 -0600 Subject: [PATCH 24/28] Updates to delete any existing archived configs during update process to prevent name conflicts --- .../AppServer/Messengers/ConfigMessenger.cs | 12 +++++++++++- .../AppServer/Messengers/SystemMonitorMessenger.cs | 7 +++++-- essentials-framework | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs index 549bf17b..a54a9b9f 100644 --- a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs @@ -34,7 +34,17 @@ namespace PepperDash.Essentials.AppServer.Messengers void GetConfigFile(string url) { - url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid); + try + { + var parser = new Crestron.SimplSharp.Net.Http.UrlParser(url); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully parsed URL from AppServer message: {0}", parser.Url); + } + catch + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to parse URL from AppServer message. Generating URL from config data"); + url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid); + } ConfigUpdater.GetConfigFromServer(url); } diff --git a/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs b/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs index 7b56ab29..12107ff5 100644 --- a/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/SystemMonitorMessenger.cs @@ -40,8 +40,11 @@ namespace PepperDash.Essentials.AppServer.Messengers /// void ProgramInfoChanged(object sender, ProgramInfoEventArgs e) { - Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString()); - PostStatusMessage(e.ProgramInfo); + if (e.ProgramInfo != null) + { + //Debug.Console(1, "Posting Status Message: {0}", e.ProgramInfo.ToString()); + PostStatusMessage(e.ProgramInfo); + } } /// diff --git a/essentials-framework b/essentials-framework index e1f26dc6..1393abd8 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit e1f26dc6e005cf4cd2e2401564dfb61b504f6b72 +Subproject commit 1393abd812273e57b2802837331c23be5ccaf5a8 From e3a3a2cd2deaae48fbfc3ae21e47235c11bf489a Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 15 Mar 2019 14:42:47 -0600 Subject: [PATCH 25/28] Attempting to resolve exception in CotijaSystemController when SystemMonitor tries to notify AppServer of program start before WSClient is *really* connected. --- .../AppServer/CotijaSystemController.cs | 3 ++- .../AppServer/Messengers/ConfigMessenger.cs | 10 +++++++++- essentials-framework | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/PepperDashEssentials/AppServer/CotijaSystemController.cs b/PepperDashEssentials/AppServer/CotijaSystemController.cs index 44b007ef..92704711 100644 --- a/PepperDashEssentials/AppServer/CotijaSystemController.cs +++ b/PepperDashEssentials/AppServer/CotijaSystemController.cs @@ -458,10 +458,11 @@ namespace PepperDash.Essentials var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME); if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS) { +#warning It seems like this debug statement is throwing an exception when called Debug.Console(1, this, "Socket send result error: {0}", result); } } - else if (!WSClient.Connected) + else if (WSClient == null) { Debug.Console(1, this, "Cannot send. Not connected {0}"); } diff --git a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs index a54a9b9f..1e3cfa12 100644 --- a/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/ConfigMessenger.cs @@ -32,16 +32,24 @@ namespace PepperDash.Essentials.AppServer.Messengers appServerController.AddAction(MessagePath + "/updateConfig", new Action(s => GetConfigFile(s))); } + /// + /// Generates or passes the URL to make the request to GET the config from a server + /// + /// void GetConfigFile(string url) { try { + // Attempt to parse the URL var parser = new Crestron.SimplSharp.Net.Http.UrlParser(url); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Successfully parsed URL from AppServer message: {0}", parser.Url); } - catch + catch (Exception e) { + // If unable to parse the URL, generate it from config data + Debug.Console(2, "Error parsing URL: {0}", e); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Unable to parse URL from AppServer message. Generating URL from config data"); url = string.Format("http://{0}/api/system/{1}/config", AppServerController.Config.ServerUrl, AppServerController.SystemUuid); } diff --git a/essentials-framework b/essentials-framework index 1393abd8..07171276 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 1393abd812273e57b2802837331c23be5ccaf5a8 +Subproject commit 071712762dba2d25c6ef186cc8b7237ea4aa774d From 3adee8bc304fe28947ce8b471c99dce9c0a1eb6e Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 18 Mar 2019 11:25:46 -0600 Subject: [PATCH 26/28] Resolves ecs-1042 --- PepperDashEssentials/AppServer/CotijaSystemController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PepperDashEssentials/AppServer/CotijaSystemController.cs b/PepperDashEssentials/AppServer/CotijaSystemController.cs index 92704711..75592e38 100644 --- a/PepperDashEssentials/AppServer/CotijaSystemController.cs +++ b/PepperDashEssentials/AppServer/CotijaSystemController.cs @@ -458,13 +458,12 @@ namespace PepperDash.Essentials var result = WSClient.Send(messageBytes, (uint)messageBytes.Length, WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME); if (result != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS) { -#warning It seems like this debug statement is throwing an exception when called Debug.Console(1, this, "Socket send result error: {0}", result); } } else if (WSClient == null) { - Debug.Console(1, this, "Cannot send. Not connected {0}"); + Debug.Console(1, this, "Cannot send. Not connected."); } } From 2655b8f7b805dc7585ad5fc8ddd6e422629ae08d Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 2 Apr 2019 15:58:12 -0600 Subject: [PATCH 27/28] Resolves issue with HuddleVtc1Room adding Emergency device in CustomActivate() which would throw an exception in DeviceManager.ActivateAll() when attempting to iterate the modified devices dictionary --- PepperDashEssentials/ControlSystem.cs | 4 ++-- .../Room/Config/EssentialsRoomConfig.cs | 2 +- .../Room/Types/EssentialsHuddleVtc1Room.cs | 16 ++++++++++------ essentials-framework | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8463390a..4b75f046 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -71,7 +71,7 @@ namespace PepperDash.Essentials } /// - /// Determines if the program is running on a processor (appliance) or server (XiO Edge). + /// Determines if the program is running on a processor (appliance) or server (VC-4). /// /// Sets Global.FilePathPrefix based on platform /// @@ -176,7 +176,7 @@ namespace PepperDash.Essentials } - // Notify the + // Notify the OS that the program intitialization has completed SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; } diff --git a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs index 4ceb481d..7b7718eb 100644 --- a/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs +++ b/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs @@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Room.Config var microphonePrivacy = props.MicrophonePrivacy; if (microphonePrivacy == null) { - Debug.Console(0, "ERROR: Cannot create microphone privacy with null properties"); + Debug.Console(0, "Cannot create microphone privacy with null properties"); return null; } // Get the MicrophonePrivacy device from the device manager diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 2c5ca160..d83c8e9a 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -266,6 +266,16 @@ namespace PepperDash.Essentials { IsCoolingDownFeedback.FireUpdate(); }; + + // Get Microphone Privacy object, if any + this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); + + Debug.Console(2, this, "Microphone Privacy Config evaluated."); + + // Get emergency object, if any + this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); + + Debug.Console(2, this, "Emergency Config evaluated."); } @@ -327,12 +337,6 @@ namespace PepperDash.Essentials this.DefaultSourceItem = PropertiesConfig.DefaultSourceItem; this.DefaultVolume = (ushort)(PropertiesConfig.Volumes.Master.Level * 65535 / 100); - // Get Microphone Privacy object, if any - this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this); - - // Get emergency object, if any - this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this); - return base.CustomActivate(); } diff --git a/essentials-framework b/essentials-framework index 07171276..f5cda527 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 071712762dba2d25c6ef186cc8b7237ea4aa774d +Subproject commit f5cda5276ef161625157983332aed48140ec2ac9 From 71a27027e7bc10217e81625513616e9efd7cf6b5 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 2 Apr 2019 16:04:46 -0600 Subject: [PATCH 28/28] Updates framework commit to development branch --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index f5cda527..d2326163 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit f5cda5276ef161625157983332aed48140ec2ac9 +Subproject commit d23261633943f87c4f8c7568f285f5de2a839667