Preparing essentials message changes, noticed that 754 has not been merged

This commit is contained in:
Heath Volmer
2018-08-01 11:38:39 -06:00
parent 9eb9485bba
commit d1d8e29be2
8 changed files with 107 additions and 39 deletions

View File

@@ -94,7 +94,7 @@ namespace PepperDash.Essentials
{ {
filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator; 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); 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"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1)); 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 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); DeviceManager.AddDevice(room);
} }
@@ -343,7 +349,8 @@ namespace PepperDash.Essentials
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController; var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController;
if (parent == null) 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"); Debug.Console(0, bridge, "Linking to parent controller");
bridge.AddParent(parent); bridge.AddParent(parent);

View File

@@ -6,8 +6,51 @@ using Crestron.SimplSharp;
namespace PepperDash.Essentials.Room.Cotija namespace PepperDash.Essentials.Room.Cotija
{ {
/// <summary>
/// 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.
/// </summary>
public interface IDelayedConfiguration public interface IDelayedConfiguration
{ {
event EventHandler<EventArgs> ConfigurationIsReady; event EventHandler<EventArgs> ConfigurationIsReady;
} }
} }
namespace PepperDash.Essentials
{
/// <summary>
/// For rooms with a single presentation source, change event
/// </summary>
public interface IHasCurrentSourceInfoChange
{
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
/// <summary>
/// For rooms with routing
/// </summary>
public interface IRunRouteAction
{
void RunRouteAction(string routeKey);
void RunRouteAction(string routeKey, Action successCallback);
}
/// <summary>
/// For rooms that default presentation only routing
/// </summary>
public interface IRunDefaultPresentRoute
{
void RunDefaultPresentRoute();
}
/// <summary>
/// For rooms that have default presentation and calling routes
/// </summary>
public interface IRunDefaultCallRoute : IRunDefaultPresentRoute
{
void RunDefaultCallRoute();
}
}

View File

@@ -13,7 +13,7 @@ namespace PepperDash.Essentials
public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase public class CotijaEssentialsHuddleSpaceRoomBridge : CotijaBridgeBase
{ {
public EssentialsHuddleSpaceRoom Room { get; private set; } public EssentialsRoomBase Room { get; private set; }
/// <summary> /// <summary>
/// ///
@@ -52,21 +52,45 @@ namespace PepperDash.Essentials
// Source Changes and room off // 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}/status", Room.Key), new Action(() => Room_RoomFullStatus(Room)));
Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(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<ushort>(u => var routeRoom = Room as IRunRouteAction;
(Room.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u))); if(routeRoom != null)
Parent.AddAction(string.Format(@"/room/{0}/masterVolumeMuteToggle", Room.Key), new Action(() => Room.CurrentVolumeControls.MuteToggle())); Parent.AddAction(string.Format(@"/room/{0}/source", Room.Key), new Action<SourceSelectMessageContent>(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<ushort>(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<VolumeDeviceChangeEventArgs>(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}/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}/shutdownEnd", Room.Key), new Action(() => Room.ShutdownPromptTimer.Finish()));
Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel())); Parent.AddAction(string.Format(@"/room/{0}/shutdownCancel", Room.Key), new Action(() => Room.ShutdownPromptTimer.Cancel()));
Room.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSingleSourceChange);
Room.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
Room.OnFeedback.OutputChange += OnFeedback_OutputChange; Room.OnFeedback.OutputChange += OnFeedback_OutputChange;
Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; Room.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange; Room.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedback_OutputChange;
@@ -74,20 +98,19 @@ namespace PepperDash.Essentials
Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; Room.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; Room.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; Room.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
}
// Registers for initial volume events, if possible /// <summary>
var currentVolumeDevice = Room.CurrentVolumeControls; /// Helper for posting status message
/// </summary>
if (currentVolumeDevice != null) /// <param name="contentObject">The contents of the content object</param>
void PostStatusMessage(object contentObject)
{
Parent.SendMessageToServer(JObject.FromObject(new
{ {
if (currentVolumeDevice is IBasicVolumeWithFeedback) type = "/room/status/",
{ content = contentObject
var newDev = currentVolumeDevice as IBasicVolumeWithFeedback; }));
newDev.MuteFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
newDev.VolumeLevelFeedback.OutputChange += VolumeLevelFeedback_OutputChange;
}
}
} }
/// <summary> /// <summary>
@@ -231,6 +254,8 @@ namespace PepperDash.Essentials
if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback) if(huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)
{ {
JObject roomStatus = new JObject(); JObject roomStatus = new JObject();
if (huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback) if (huddleRoom.CurrentVolumeControls is IBasicVolumeWithFeedback)

View File

@@ -10,7 +10,7 @@ using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute
{ {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;
@@ -202,7 +202,7 @@ namespace PepperDash.Essentials
{ {
SetDefaultLevels(); SetDefaultLevels();
RunDefaultRoute(); RunDefaultPresentRoute();
CrestronEnvironment.Sleep(1000); CrestronEnvironment.Sleep(1000);
@@ -212,7 +212,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Routes the default source item, if any /// Routes the default source item, if any
/// </summary> /// </summary>
public void RunDefaultRoute() public void RunDefaultPresentRoute()
{ {
//if (DefaultSourceItem != null && !OnFeedback.BoolValue) //if (DefaultSourceItem != null && !OnFeedback.BoolValue)
RunRouteAction(DefaultSourceItem); RunRouteAction(DefaultSourceItem);

View File

@@ -12,7 +12,8 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy, IHasCurrentVolumeControls public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange,
IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute
{ {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;

View File

@@ -9,14 +9,6 @@ using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
/// <summary>
///
/// </summary>
public interface IHasCurrentSourceInfoChange
{
event SourceInfoChangeHandler CurrentSingleSourceChange;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@@ -480,7 +480,7 @@ namespace PepperDash.Essentials
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
// Run default source when room is off and share is pressed // Run default source when room is off and share is pressed
if (!CurrentRoom.OnFeedback.BoolValue) if (!CurrentRoom.OnFeedback.BoolValue)
CurrentRoom.RunDefaultRoute(); CurrentRoom.RunDefaultPresentRoute();
} }