mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 17:54:59 +00:00
Updates to JoinMapBase to support better definition of joins.
This commit is contained in:
@@ -42,7 +42,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
appServerController.AddAction(MessagePath + "/fullStatus", new Action(SendRoutingFullMessageObject));
|
||||
|
||||
appServerController.AddAction(string.Format(@"/device/inRoomPc-1/source"), new Action<SourceSelectMessageContent>(c =>
|
||||
appServerController.AddAction(MessagePath + "/source", new Action<SourceSelectMessageContent>(c =>
|
||||
{
|
||||
RoutingDevice.RunRouteAction(c.SourceListItem, c.SourceListKey);
|
||||
}));
|
||||
|
||||
@@ -12,7 +12,7 @@ using PepperDash.Essentials.Devices.Common.Codec;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class Ddvc01AtcMessenger : MessengerBase
|
||||
public class SIMPLAtcMessenger : MessengerBase
|
||||
{
|
||||
BasicTriList EISC;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
/// <param name="eisc"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
public SIMPLAtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
EISC = eisc;
|
||||
@@ -13,7 +13,7 @@ using PepperDash.Essentials.Devices.Common.Cameras;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
public class Ddvc01VtcMessenger : MessengerBase
|
||||
public class SIMPLVtcMessenger : MessengerBase
|
||||
{
|
||||
BasicTriList EISC;
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
/// </summary>
|
||||
/// <param name="eisc"></param>
|
||||
/// <param name="messagePath"></param>
|
||||
public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
public SIMPLVtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||
: base(key, messagePath)
|
||||
{
|
||||
EISC = eisc;
|
||||
@@ -18,10 +18,16 @@ using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
public class MobileControlDdvc01RoomBridge : MobileControlBridgeBase, IDelayedConfiguration
|
||||
public class MobileControlSIMPLRoomBridge : MobileControlBridgeBase, IDelayedConfiguration
|
||||
{
|
||||
public class BoolJoin
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// </summary>
|
||||
public const uint ConfigIsInEssentials = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 301
|
||||
/// </summary>
|
||||
@@ -237,8 +243,8 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
|
||||
MobileControlDdvc01DeviceBridge SourceBridge;
|
||||
|
||||
Ddvc01AtcMessenger AtcMessenger;
|
||||
Ddvc01VtcMessenger VtcMessenger;
|
||||
SIMPLAtcMessenger AtcMessenger;
|
||||
SIMPLVtcMessenger VtcMessenger;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -247,7 +253,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="ipId"></param>
|
||||
public MobileControlDdvc01RoomBridge(string key, string name, uint ipId)
|
||||
public MobileControlSIMPLRoomBridge(string key, string name, uint ipId)
|
||||
: base(key, name)
|
||||
{
|
||||
try
|
||||
@@ -278,24 +284,33 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
SetupFeedbacks();
|
||||
|
||||
var atcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
|
||||
AtcMessenger = new Ddvc01AtcMessenger(atcKey, EISC, "/device/audioCodec");
|
||||
AtcMessenger = new SIMPLAtcMessenger(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 = new SIMPLVtcMessenger(vtcKey, EISC, "/device/videoCodec");
|
||||
VtcMessenger.RegisterWithAppServer(Parent);
|
||||
|
||||
EISC.SigChange += EISC_SigChange;
|
||||
EISC.OnlineStatusChange += (o, a) =>
|
||||
{
|
||||
Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}", a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue);
|
||||
Debug.Console(1, this, "DDVC EISC online={0}. Config is ready={1}. Use Essentials Config={2}",
|
||||
a.DeviceOnLine, EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue, EISC.BooleanOutput[BoolJoin.ConfigIsInEssentials].BoolValue);
|
||||
|
||||
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
|
||||
LoadConfigValues();
|
||||
|
||||
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsInEssentials].BoolValue)
|
||||
UseEssentialsConfig();
|
||||
};
|
||||
// load config if it's already there
|
||||
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
||||
LoadConfigValues();
|
||||
|
||||
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsInEssentials].BoolValue)
|
||||
{
|
||||
UseEssentialsConfig();
|
||||
}
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(s =>
|
||||
{
|
||||
@@ -322,6 +337,22 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
return base.CustomActivate();
|
||||
}
|
||||
|
||||
void UseEssentialsConfig()
|
||||
{
|
||||
ConfigIsLoaded = false;
|
||||
|
||||
SetupDeviceMessengers();
|
||||
|
||||
Debug.Console(0, this, "******* ESSENTIALS CONFIG: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented));
|
||||
|
||||
var handler = ConfigurationIsReady;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new EventArgs());
|
||||
}
|
||||
|
||||
ConfigIsLoaded = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the actions to take place on various incoming API calls
|
||||
@@ -373,6 +404,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -782,13 +816,18 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
|
||||
var messengerKey = string.Format("device-{0}-{1}", this.Key, Parent.Key);
|
||||
|
||||
if (DeviceManager.GetDeviceForKey(messengerKey) != null)
|
||||
{
|
||||
Debug.Console(2, this, "Messenger with key: {0} already exists. Skipping...", messengerKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
var dev = ConfigReader.ConfigObject.GetDeviceForKey(props.DeviceKey);
|
||||
|
||||
if (dev == null)
|
||||
{
|
||||
Debug.Console(1, this, "Unable to find device config for key: '{0}'", props.DeviceKey);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
var type = device.Type.ToLower();
|
||||
@@ -798,7 +837,6 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
{
|
||||
Debug.Console(2, this, "Adding SIMPLCameraMessenger for: '{0}'", props.DeviceKey);
|
||||
messenger = new SIMPLCameraMessenger(messengerKey, EISC, "/device/" + props.DeviceKey, props.JoinStart);
|
||||
|
||||
}
|
||||
else if (type.Equals("simplroutemessenger"))
|
||||
{
|
||||
@@ -931,12 +969,15 @@ namespace PepperDash.Essentials.Room.MobileControl
|
||||
if (Debug.Level >= 1)
|
||||
Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||
var uo = args.Sig.UserObject;
|
||||
if (uo is Action<bool>)
|
||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||
else if (uo is Action<ushort>)
|
||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||
else if (uo is Action<string>)
|
||||
(uo as Action<string>)(args.Sig.StringValue);
|
||||
if (uo != null)
|
||||
{
|
||||
if (uo is Action<bool>)
|
||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||
else if (uo is Action<ushort>)
|
||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||
else if (uo is Action<string>)
|
||||
(uo as Action<string>)(args.Sig.StringValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -25,6 +25,19 @@ namespace PepperDash.Essentials.Bridges
|
||||
|
||||
public CameraControllerJoinMap()
|
||||
{
|
||||
Joins = new Dictionary<string, JoinMetadata>();
|
||||
|
||||
Joins.Add("isOnline", new JoinMetadata()
|
||||
{ JoinNumber = 9, Label = "IsOnline", JoinCapabilities = eJoinCapabilities.Write, JoinSpan = 1, JoinType = eJoinType.Digital });
|
||||
Joins.Add("powerOn", new JoinMetadata()
|
||||
{ JoinNumber = 7, Label = "PowerOn", JoinCapabilities = eJoinCapabilities.Read | eJoinCapabilities.Write, JoinSpan = 1, JoinType = eJoinType.Digital });
|
||||
Joins.Add("powerOff", new JoinMetadata()
|
||||
{ JoinNumber = 8, Label = "PowerOff", JoinCapabilities = eJoinCapabilities.Read | eJoinCapabilities.Write, JoinSpan = 1, JoinType = eJoinType.Digital });
|
||||
Joins.Add("up", new JoinMetadata()
|
||||
{ JoinNumber = 1, Label = "TiltUp", JoinCapabilities = eJoinCapabilities.Write, JoinSpan = 1, JoinType = eJoinType.Digital });
|
||||
|
||||
|
||||
|
||||
// Digital
|
||||
IsOnline = 9;
|
||||
PowerOff = 8;
|
||||
@@ -37,14 +50,23 @@ namespace PepperDash.Essentials.Bridges
|
||||
ZoomOut = 6;
|
||||
PresetRecallOffset = 10;
|
||||
PresetSaveOffset = 30;
|
||||
NumberOfPresets = 5;
|
||||
|
||||
// Analog
|
||||
NumberOfPresets = 5;
|
||||
}
|
||||
|
||||
public override void OffsetJoinNumbers(uint joinStart)
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
|
||||
foreach (var join in Joins)
|
||||
{
|
||||
join.Value.JoinNumber = join.Value.JoinNumber + joinOffset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
PowerOff = PowerOff + joinOffset;
|
||||
PowerOn = PowerOn + joinOffset;
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
||||
|
||||
var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlDdvc01RoomBridge(key, name, comm.IpIdInt);
|
||||
var bridge = new PepperDash.Essentials.Room.MobileControl.MobileControlSIMPLRoomBridge(key, name, comm.IpIdInt);
|
||||
bridge.AddPreActivationAction(() =>
|
||||
{
|
||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
||||
|
||||
@@ -110,9 +110,9 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AppServer\Messengers\CameraBaseMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\ConfigMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\Ddvc01AtcMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\SIMPLAtcMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\AudioCodecBaseMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\SIMPLVtcMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\IRunRouteActionMessenger.cs" />
|
||||
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
||||
<Compile Include="AppServer\Messengers\SIMPLCameraMessenger.cs" />
|
||||
|
||||
@@ -40,8 +40,33 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="joinStart"></param>
|
||||
public abstract void OffsetJoinNumbers(uint joinStart);
|
||||
|
||||
public Dictionary<string, JoinMetadata> Joins { get; set; }
|
||||
}
|
||||
|
||||
public enum eJoinCapabilities
|
||||
{
|
||||
Read = 1,
|
||||
Write = 2
|
||||
}
|
||||
|
||||
public enum eJoinType
|
||||
{
|
||||
Digital = 1,
|
||||
Analog = 2,
|
||||
Serial = 4
|
||||
}
|
||||
|
||||
public class JoinMetadata
|
||||
{
|
||||
public string Label { get; set; }
|
||||
public eJoinType JoinType { get; set; }
|
||||
public uint JoinNumber { get; set; }
|
||||
public uint JoinSpan { get; set; }
|
||||
public eJoinCapabilities JoinCapabilities { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user