mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +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(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);
|
RoutingDevice.RunRouteAction(c.SourceListItem, c.SourceListKey);
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using PepperDash.Essentials.Devices.Common.Codec;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
public class Ddvc01AtcMessenger : MessengerBase
|
public class SIMPLAtcMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
BasicTriList EISC;
|
BasicTriList EISC;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eisc"></param>
|
/// <param name="eisc"></param>
|
||||||
/// <param name="messagePath"></param>
|
/// <param name="messagePath"></param>
|
||||||
public Ddvc01AtcMessenger(string key, BasicTriList eisc, string messagePath)
|
public SIMPLAtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
: base(key, messagePath)
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
EISC = eisc;
|
EISC = eisc;
|
||||||
@@ -13,7 +13,7 @@ using PepperDash.Essentials.Devices.Common.Cameras;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.AppServer.Messengers
|
namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
{
|
{
|
||||||
public class Ddvc01VtcMessenger : MessengerBase
|
public class SIMPLVtcMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
BasicTriList EISC;
|
BasicTriList EISC;
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="eisc"></param>
|
/// <param name="eisc"></param>
|
||||||
/// <param name="messagePath"></param>
|
/// <param name="messagePath"></param>
|
||||||
public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath)
|
public SIMPLVtcMessenger(string key, BasicTriList eisc, string messagePath)
|
||||||
: base(key, messagePath)
|
: base(key, messagePath)
|
||||||
{
|
{
|
||||||
EISC = eisc;
|
EISC = eisc;
|
||||||
@@ -18,10 +18,16 @@ using PepperDash.Essentials.Room.Config;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.Room.MobileControl
|
namespace PepperDash.Essentials.Room.MobileControl
|
||||||
{
|
{
|
||||||
public class MobileControlDdvc01RoomBridge : MobileControlBridgeBase, IDelayedConfiguration
|
public class MobileControlSIMPLRoomBridge : MobileControlBridgeBase, IDelayedConfiguration
|
||||||
{
|
{
|
||||||
public class BoolJoin
|
public class BoolJoin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1
|
||||||
|
/// </summary>
|
||||||
|
public const uint ConfigIsInEssentials = 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 301
|
/// 301
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -237,8 +243,8 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
|
|
||||||
MobileControlDdvc01DeviceBridge SourceBridge;
|
MobileControlDdvc01DeviceBridge SourceBridge;
|
||||||
|
|
||||||
Ddvc01AtcMessenger AtcMessenger;
|
SIMPLAtcMessenger AtcMessenger;
|
||||||
Ddvc01VtcMessenger VtcMessenger;
|
SIMPLVtcMessenger VtcMessenger;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -247,7 +253,7 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
/// <param name="key"></param>
|
/// <param name="key"></param>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="ipId"></param>
|
/// <param name="ipId"></param>
|
||||||
public MobileControlDdvc01RoomBridge(string key, string name, uint ipId)
|
public MobileControlSIMPLRoomBridge(string key, string name, uint ipId)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -278,24 +284,33 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
SetupFeedbacks();
|
SetupFeedbacks();
|
||||||
|
|
||||||
var atcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
|
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);
|
AtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
var vtcKey = string.Format("atc-{0}-{1}", this.Key, Parent.Key);
|
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);
|
VtcMessenger.RegisterWithAppServer(Parent);
|
||||||
|
|
||||||
EISC.SigChange += EISC_SigChange;
|
EISC.SigChange += EISC_SigChange;
|
||||||
EISC.OnlineStatusChange += (o, a) =>
|
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)
|
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue)
|
||||||
LoadConfigValues();
|
LoadConfigValues();
|
||||||
|
|
||||||
|
if (a.DeviceOnLine && EISC.BooleanOutput[BoolJoin.ConfigIsInEssentials].BoolValue)
|
||||||
|
UseEssentialsConfig();
|
||||||
};
|
};
|
||||||
// load config if it's already there
|
// load config if it's already there
|
||||||
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsReady].BoolValue) // || EISC.BooleanInput[BoolJoin.ConfigIsReady].BoolValue)
|
||||||
LoadConfigValues();
|
LoadConfigValues();
|
||||||
|
|
||||||
|
if (EISC.IsOnline && EISC.BooleanOutput[BoolJoin.ConfigIsInEssentials].BoolValue)
|
||||||
|
{
|
||||||
|
UseEssentialsConfig();
|
||||||
|
}
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
{
|
{
|
||||||
@@ -322,6 +337,22 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
return base.CustomActivate();
|
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>
|
/// <summary>
|
||||||
/// Setup the actions to take place on various incoming API calls
|
/// Setup the actions to take place on various incoming API calls
|
||||||
@@ -373,6 +404,9 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
EISC.PulseBool(BoolJoin.ShutdownCancel)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -782,13 +816,18 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
|
|
||||||
var messengerKey = string.Format("device-{0}-{1}", this.Key, Parent.Key);
|
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);
|
var dev = ConfigReader.ConfigObject.GetDeviceForKey(props.DeviceKey);
|
||||||
|
|
||||||
if (dev == null)
|
if (dev == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Unable to find device config for key: '{0}'", props.DeviceKey);
|
Debug.Console(1, this, "Unable to find device config for key: '{0}'", props.DeviceKey);
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var type = device.Type.ToLower();
|
var type = device.Type.ToLower();
|
||||||
@@ -798,7 +837,6 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
{
|
{
|
||||||
Debug.Console(2, this, "Adding SIMPLCameraMessenger for: '{0}'", props.DeviceKey);
|
Debug.Console(2, this, "Adding SIMPLCameraMessenger for: '{0}'", props.DeviceKey);
|
||||||
messenger = new SIMPLCameraMessenger(messengerKey, EISC, "/device/" + props.DeviceKey, props.JoinStart);
|
messenger = new SIMPLCameraMessenger(messengerKey, EISC, "/device/" + props.DeviceKey, props.JoinStart);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (type.Equals("simplroutemessenger"))
|
else if (type.Equals("simplroutemessenger"))
|
||||||
{
|
{
|
||||||
@@ -931,12 +969,15 @@ namespace PepperDash.Essentials.Room.MobileControl
|
|||||||
if (Debug.Level >= 1)
|
if (Debug.Level >= 1)
|
||||||
Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
Debug.Console(1, this, "DDVC EISC change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
var uo = args.Sig.UserObject;
|
var uo = args.Sig.UserObject;
|
||||||
if (uo is Action<bool>)
|
if (uo != null)
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
{
|
||||||
else if (uo is Action<ushort>)
|
if (uo is Action<bool>)
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
else if (uo is Action<string>)
|
else if (uo is Action<ushort>)
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
|
|
||||||
public CameraControllerJoinMap()
|
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
|
// Digital
|
||||||
IsOnline = 9;
|
IsOnline = 9;
|
||||||
PowerOff = 8;
|
PowerOff = 8;
|
||||||
@@ -37,14 +50,23 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
ZoomOut = 6;
|
ZoomOut = 6;
|
||||||
PresetRecallOffset = 10;
|
PresetRecallOffset = 10;
|
||||||
PresetSaveOffset = 30;
|
PresetSaveOffset = 30;
|
||||||
NumberOfPresets = 5;
|
|
||||||
// Analog
|
// Analog
|
||||||
|
NumberOfPresets = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OffsetJoinNumbers(uint joinStart)
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
{
|
{
|
||||||
var joinOffset = joinStart - 1;
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var join in Joins)
|
||||||
|
{
|
||||||
|
join.Value.JoinNumber = join.Value.JoinNumber + joinOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IsOnline = IsOnline + joinOffset;
|
IsOnline = IsOnline + joinOffset;
|
||||||
PowerOff = PowerOff + joinOffset;
|
PowerOff = PowerOff + joinOffset;
|
||||||
PowerOn = PowerOn + joinOffset;
|
PowerOn = PowerOn + joinOffset;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
var comm = CommFactory.GetControlPropertiesConfig(dc);
|
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(() =>
|
bridge.AddPreActivationAction(() =>
|
||||||
{
|
{
|
||||||
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as MobileControlSystemController;
|
||||||
|
|||||||
@@ -110,9 +110,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AppServer\Messengers\CameraBaseMessenger.cs" />
|
<Compile Include="AppServer\Messengers\CameraBaseMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\ConfigMessenger.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\AudioCodecBaseMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\Ddvc01VtcMessenger.cs" />
|
<Compile Include="AppServer\Messengers\SIMPLVtcMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\IRunRouteActionMessenger.cs" />
|
<Compile Include="AppServer\Messengers\IRunRouteActionMessenger.cs" />
|
||||||
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
<Compile Include="AppServer\Messengers\MessengerBase.cs" />
|
||||||
<Compile Include="AppServer\Messengers\SIMPLCameraMessenger.cs" />
|
<Compile Include="AppServer\Messengers\SIMPLCameraMessenger.cs" />
|
||||||
|
|||||||
@@ -40,8 +40,33 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <param name="joinStart"></param>
|
/// <param name="joinStart"></param>
|
||||||
public abstract void OffsetJoinNumbers(uint joinStart);
|
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