diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 06c63c05..44da9ded 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -94,7 +94,7 @@ namespace PepperDash.Essentials { filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator; - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on XiO Edge Server", versionString); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on Virtual Control Server", versionString); } Global.SetFilePathPrefix(filePathPrefix); @@ -316,10 +316,16 @@ namespace PepperDash.Essentials Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1)); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); + // Cotija bridge + var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); + AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present + DeviceManager.AddDevice(bridge); } else { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsHuddleSpaceRoom, attempting to add to DeviceManager w/o Fusion"); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion"); DeviceManager.AddDevice(room); } @@ -343,7 +349,8 @@ namespace PepperDash.Essentials var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController; if (parent == null) { - Debug.Console(0, bridge, "ERROR: Cannot connect bridge. System controller not present"); + Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present"); + return; } Debug.Console(0, bridge, "Linking to parent controller"); bridge.AddParent(parent); diff --git a/PepperDashEssentials/Room/Cotija/Interfaces.cs b/PepperDashEssentials/Room/Cotija/Interfaces.cs index 1aab82fb..a20f614b 100644 --- a/PepperDashEssentials/Room/Cotija/Interfaces.cs +++ b/PepperDashEssentials/Room/Cotija/Interfaces.cs @@ -6,8 +6,51 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Room.Cotija { + /// + /// Represents a room whose configuration is derived from runtime data, + /// perhaps from another program, and that the data may not be fully + /// available at startup. + /// public interface IDelayedConfiguration { event EventHandler ConfigurationIsReady; } +} + +namespace PepperDash.Essentials +{ + /// + /// For rooms with a single presentation source, change event + /// + public interface IHasCurrentSourceInfoChange + { + event SourceInfoChangeHandler CurrentSingleSourceChange; + } + + + /// + /// For rooms with routing + /// + public interface IRunRouteAction + { + void RunRouteAction(string routeKey); + + void RunRouteAction(string routeKey, Action successCallback); + } + + /// + /// For rooms that default presentation only routing + /// + public interface IRunDefaultPresentRoute + { + void RunDefaultPresentRoute(); + } + + /// + /// For rooms that have default presentation and calling routes + /// + public interface IRunDefaultCallRoute : IRunDefaultPresentRoute + { + void RunDefaultCallRoute(); + } } \ No newline at end of file diff --git a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs index 2f3cf440..cae7555d 100644 --- a/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs +++ b/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaEssentialsHuddleSpaceRoomBridge.cs @@ -13,7 +13,7 @@ namespace PepperDash.Essentials public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase { - public EssentialsHuddleSpaceRoom Room { get; private set; } + public EssentialsRoomBase Room { get; private set; } /// /// @@ -52,21 +52,45 @@ namespace PepperDash.Essentials // Source Changes and room off Parent.AddAction(string.Format(@"/room/{0}/status", Room.Key), new Action(() => Room_RoomFullStatus(Room))); - Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action(c => Room.RunRouteAction(c.SourceListItem))); - Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(Room.RunDefaultRoute)); - Parent.AddAction(string.Format(@"/room/{0}/masterVolumeLevel", Room.Key), new Action(u => - (Room.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); - Parent.AddAction(string.Format(@"/room/{0}/masterVolumeMuteToggle", Room.Key), new Action(() => Room.CurrentVolumeControls.MuteToggle())); + var routeRoom = Room as IRunRouteAction; + if(routeRoom != null) + Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action(c => routeRoom.RunRouteAction(c.SourceListItem))); + + var defaultRoom = Room as IRunDefaultPresentRoute; + if(defaultRoom != null) + Parent.AddAction(string.Format(@"/room/{0}/defaultsource", Room.Key), new Action(defaultRoom.RunDefaultPresentRoute)); + + var vcRoom = Room as IHasCurrentVolumeControls; + if (vcRoom != null) + { + Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action(u => + (vcRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); + Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() => + vcRoom.CurrentVolumeControls.MuteToggle())); + vcRoom.CurrentVolumeDeviceChange += new EventHandler(Room_CurrentVolumeDeviceChange); + + // Registers for initial volume events, if possible + var currentVolumeDevice = vcRoom.CurrentVolumeControls; + if (currentVolumeDevice != null) + { + if (currentVolumeDevice is IBasicVolumeWithFeedback) + { + var newDev = currentVolumeDevice as IBasicVolumeWithFeedback; + newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange; + newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange; + } + } + } + + var sscRoom = Room as IHasCurrentSourceInfoChange; + if(sscRoom != null) + sscRoom.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); Parent.AddAction(string.Format(@"/room/{0}/shutdownStart", Room.Key), new Action(() => Room.StartShutdown(eShutdownType.Manual))); Parent.AddAction(string.Format(@"/room/{0}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish())); Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel())); - Room.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange); - - Room.CurrentVolumeDeviceChange += new EventHandler(Room_CurrentVolumeDeviceChange); - Room.OnFeedback.OutputChange += OnFeedback_OutputChange; Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange; @@ -74,20 +98,19 @@ namespace PepperDash.Essentials Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; + } - // Registers for initial volume events, if possible - var currentVolumeDevice = Room.CurrentVolumeControls; - - if (currentVolumeDevice != null) + /// + /// Helper for posting status message + /// + /// The contents of the content object + void PostStatusMessage(object contentObject) + { + Parent.SendMessageToServer(JObject.FromObject(new { - if (currentVolumeDevice is IBasicVolumeWithFeedback) - { - var newDev = currentVolumeDevice as IBasicVolumeWithFeedback; - - newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange; - newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange; - } - } + type = "/room/status/", + content = contentObject + })); } /// @@ -231,6 +254,8 @@ namespace PepperDash.Essentials if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback) { + + JObject roomStatus = new JObject(); if (huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index 5493fd9d..ef001150 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -10,7 +10,7 @@ using PepperDash.Essentials.Room.Config; namespace PepperDash.Essentials { - public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange + public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange; @@ -202,7 +202,7 @@ namespace PepperDash.Essentials { SetDefaultLevels(); - RunDefaultRoute(); + RunDefaultPresentRoute(); CrestronEnvironment.Sleep(1000); @@ -212,7 +212,7 @@ namespace PepperDash.Essentials /// /// Routes the default source item, if any /// - public void RunDefaultRoute() + public void RunDefaultPresentRoute() { //if (DefaultSourceItem != null && !OnFeedback.BoolValue) RunRouteAction(DefaultSourceItem); diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 60027142..0290bf98 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -12,7 +12,8 @@ using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials { - public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy, IHasCurrentVolumeControls + public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, + IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange; diff --git a/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs b/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs index 6251c067..686d18f3 100644 --- a/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs +++ b/PepperDashEssentials/Room/Types/EssentialsRoomBase.cs @@ -9,14 +9,6 @@ using PepperDash.Essentials.Devices.Common.Occupancy; namespace PepperDash.Essentials { - /// - /// - /// - public interface IHasCurrentSourceInfoChange - { - event SourceInfoChangeHandler CurrentSingleSourceChange; - } - /// /// /// diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index 99803f26..abdfeea6 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -480,7 +480,7 @@ namespace PepperDash.Essentials TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true; // Run default source when room is off and share is pressed if (!CurrentRoom.OnFeedback.BoolValue) - CurrentRoom.RunDefaultRoute(); + CurrentRoom.RunDefaultPresentRoute(); } diff --git a/essentials-framework b/essentials-framework index 4eb31deb..5a4ecc7b 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 4eb31deba608e0ba59deca4a244cf03032a0305f +Subproject commit 5a4ecc7b503efcd951ee951b4f2151f28780cf18