mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-24 18:04:57 +00:00
Compare commits
69 Commits
1.10.4
...
1.10.8-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dcafff8fb | ||
|
|
fb689c4484 | ||
|
|
40cb1b0fcf | ||
|
|
4574941288 | ||
|
|
122abc56e5 | ||
|
|
074ee190ad | ||
|
|
68a0157fbe | ||
|
|
62abbdf5e9 | ||
|
|
12248c6393 | ||
|
|
139ecc3e58 | ||
|
|
afa0a4cac2 | ||
|
|
e5393deea8 | ||
|
|
c446c3a976 | ||
|
|
49e44ec850 | ||
|
|
7298b9b767 | ||
|
|
5a8914a33f | ||
|
|
dccab58a28 | ||
|
|
19d29a03c8 | ||
|
|
41bc6a9cd4 | ||
|
|
051d50e8c9 | ||
|
|
16af75ae0d | ||
|
|
4037fad26b | ||
|
|
5a4cc2fd39 | ||
|
|
04e8508c0c | ||
|
|
cbab051c11 | ||
|
|
9c8bb66c5e | ||
|
|
96ec2cbe49 | ||
|
|
9ecaec5584 | ||
|
|
b505ad467b | ||
|
|
d8ac302f1c | ||
|
|
c3818b8bf2 | ||
|
|
bbb31aea23 | ||
|
|
4a405804c8 | ||
|
|
38c4a540a9 | ||
|
|
4c9a470885 | ||
|
|
be5158d29e | ||
|
|
8ce390d650 | ||
|
|
05066dc1ea | ||
|
|
70a78b540d | ||
|
|
5e22ca9c59 | ||
|
|
5131e73567 | ||
|
|
e02c267988 | ||
|
|
794ba7e6dd | ||
|
|
1cc37b7521 | ||
|
|
86dfc395ec | ||
|
|
05f3a7eb2c | ||
|
|
20beeb076a | ||
|
|
a74753d4a3 | ||
|
|
768a93d44d | ||
|
|
46cb10f452 | ||
|
|
5386f0fffb | ||
|
|
ad3ae0de69 | ||
|
|
892167d236 | ||
|
|
e843098ac3 | ||
|
|
1566e04edf | ||
|
|
f902a57f60 | ||
|
|
33c7038d99 | ||
|
|
7f36a00813 | ||
|
|
c4843d68f4 | ||
|
|
7e8d88c3af | ||
|
|
c539c79135 | ||
|
|
281b6f065f | ||
|
|
acfbefca00 | ||
|
|
397c0f250b | ||
|
|
a1dce1bb17 | ||
|
|
15aacbd8c8 | ||
|
|
34a695ba95 | ||
|
|
0ab1ece445 | ||
|
|
747c68bd1e |
@@ -490,21 +490,17 @@ namespace PepperDash.Essentials
|
||||
}
|
||||
}
|
||||
|
||||
AddRoomAndBuildMC(room);
|
||||
|
||||
if (room is IEssentialsHuddleSpaceRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
||||
DeviceManager.AddDevice(new Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase(room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
else if (room is IEssentialsHuddleVtc1Room)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
if (!(room is EssentialsCombinedHuddleVtc1Room))
|
||||
{
|
||||
@@ -512,28 +508,15 @@ namespace PepperDash.Essentials
|
||||
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((IEssentialsHuddleVtc1Room)room, fusionIpId, fusionJoinMapKey));
|
||||
}
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
else if (room is EssentialsTechRoom)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice,
|
||||
"Room is EssentialsTechRoom, Attempting to add to DeviceManager with Fusion with IP-ID {0:X2}", fusionIpId);
|
||||
DeviceManager.AddDevice(new EssentialsTechRoomFusionSystemController((EssentialsTechRoom)room, fusionIpId, fusionJoinMapKey));
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
|
||||
DeviceManager.AddDevice(room);
|
||||
}
|
||||
|
||||
fusionIpId += 1;
|
||||
}
|
||||
else
|
||||
@@ -547,6 +530,15 @@ namespace PepperDash.Essentials
|
||||
|
||||
}
|
||||
|
||||
private static void AddRoomAndBuildMC(IEssentialsRoom room)
|
||||
{
|
||||
DeviceManager.AddDevice(room);
|
||||
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge");
|
||||
|
||||
CreateMobileControlBridge(room);
|
||||
}
|
||||
|
||||
private static void CreateMobileControlBridge(object room)
|
||||
{
|
||||
var mobileControl = GetMobileControlDevice();
|
||||
|
||||
@@ -19,32 +19,41 @@ namespace PepperDash.Essentials.Room.Config
|
||||
/// Returns a room object from this config data
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Device GetRoomObject(DeviceConfig roomConfig)
|
||||
public static IKeyed GetRoomObject(DeviceConfig roomConfig)
|
||||
{
|
||||
var typeName = roomConfig.Type.ToLower();
|
||||
|
||||
if (typeName == "huddle")
|
||||
{
|
||||
return new EssentialsHuddleSpaceRoom(roomConfig);
|
||||
}
|
||||
if (typeName == "huddlevtc1")
|
||||
switch (typeName)
|
||||
{
|
||||
return new EssentialsHuddleVtc1Room(roomConfig);
|
||||
case "huddle" :
|
||||
{
|
||||
return new EssentialsHuddleSpaceRoom(roomConfig);
|
||||
}
|
||||
case "huddlevtc1" :
|
||||
{
|
||||
return new EssentialsHuddleVtc1Room(roomConfig);
|
||||
}
|
||||
case "ddvc01bridge" :
|
||||
{
|
||||
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
||||
}
|
||||
case "dualdisplay" :
|
||||
{
|
||||
return new EssentialsDualDisplayRoom(roomConfig);
|
||||
}
|
||||
case "combinedhuddlevtc1" :
|
||||
{
|
||||
return new EssentialsCombinedHuddleVtc1Room(roomConfig);
|
||||
}
|
||||
case "techroom" :
|
||||
{
|
||||
return new EssentialsTechRoom(roomConfig);
|
||||
}
|
||||
default :
|
||||
{
|
||||
return Core.DeviceFactory.GetDevice(roomConfig);
|
||||
}
|
||||
}
|
||||
if (typeName == "ddvc01bridge")
|
||||
{
|
||||
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
|
||||
}
|
||||
if (typeName == "dualdisplay")
|
||||
{
|
||||
return new EssentialsDualDisplayRoom(roomConfig);
|
||||
}
|
||||
if (typeName == "combinedhuddlevtc1")
|
||||
{
|
||||
return new EssentialsCombinedHuddleVtc1Room(roomConfig);
|
||||
}
|
||||
|
||||
return typeName != "techroom" ? null : new EssentialsTechRoom(roomConfig);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasDefaultDisplay
|
||||
public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasDefaultDisplay, IHasCurrentVolumeControls
|
||||
{
|
||||
bool ExcludeFromGlobalFunctions { get; }
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class PduJoinMapBase : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("Name")]
|
||||
public JoinDataComplete Name = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "PDU Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("Online")]
|
||||
public JoinDataComplete Online = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "PDU Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("OutletCount")]
|
||||
public JoinDataComplete OutletCount = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Number of COntrolled Outlets", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
[JoinName("OutletName")]
|
||||
public JoinDataComplete OutletName = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Outlet Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
|
||||
|
||||
[JoinName("OutletEnabled")]
|
||||
public JoinDataComplete OutletEnabled = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Outlet Enabled", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("OutletPowerCycle")]
|
||||
public JoinDataComplete OutletPowerCycle = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Outlet Power Cycle", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("OutletPowerOn")]
|
||||
public JoinDataComplete OutletPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Outlet Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("OutletPowerOff")]
|
||||
public JoinDataComplete OutletPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 14, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Outlet Power Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when instantiating this Join Map without inheriting from it
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
public PduJoinMapBase(uint joinStart)
|
||||
:base(joinStart, typeof(PduJoinMapBase))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to use when extending this Join map
|
||||
/// </summary>
|
||||
/// <param name="joinStart">Join this join map will start at</param>
|
||||
/// <param name="type">Type of the child join map</param>
|
||||
public PduJoinMapBase(uint joinStart, Type type)
|
||||
: base(joinStart, type)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using PepperDash.Essentials.Core;
|
||||
namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
{
|
||||
@@ -1576,6 +1576,36 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("AvailableLayoutsFb")]
|
||||
public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 142,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "xSig of all available layouts",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("SelectLayout")]
|
||||
public JoinDataComplete SelectLayout = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 142,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Select Layout by string",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
|
||||
|
||||
[JoinName("CurrentParticipants")]
|
||||
public JoinDataComplete CurrentParticipants = new JoinDataComplete(
|
||||
new JoinData
|
||||
@@ -3014,6 +3044,35 @@ namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("AvailableLayoutsFb")]
|
||||
public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 142,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "xSig of all available layouts",
|
||||
JoinCapabilities = eJoinCapabilities.ToSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
[JoinName("SelectLayout")]
|
||||
public JoinDataComplete SelectLayout = new JoinDataComplete(
|
||||
new JoinData
|
||||
{
|
||||
JoinNumber = 142,
|
||||
JoinSpan = 1
|
||||
},
|
||||
new JoinMetadata
|
||||
{
|
||||
Description = "Select Layout by string",
|
||||
JoinCapabilities = eJoinCapabilities.FromSIMPL,
|
||||
JoinType = eJoinType.Serial
|
||||
});
|
||||
|
||||
|
||||
[JoinName("CurrentParticipants")]
|
||||
public JoinDataComplete CurrentParticipants = new JoinDataComplete(
|
||||
new JoinData
|
||||
@@ -3111,4 +3170,4 @@ namespace PepperDash_Essentials_Core.Bridges.JoinMaps
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
public class DeviceConfig
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty("uid")]
|
||||
public int Uid { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("group")]
|
||||
public string Group { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("properties")]
|
||||
[JsonConverter(typeof(DevicePropertiesConverter))]
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Config
|
||||
{
|
||||
public class DeviceConfig
|
||||
{
|
||||
[JsonProperty("key")]
|
||||
public string Key { get; set; }
|
||||
|
||||
[JsonProperty("uid")]
|
||||
public int Uid { get; set; }
|
||||
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("group")]
|
||||
public string Group { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
[JsonProperty("properties")]
|
||||
[JsonConverter(typeof(DevicePropertiesConverter))]
|
||||
public JToken Properties { get; set; }
|
||||
|
||||
public DeviceConfig(DeviceConfig dc)
|
||||
@@ -39,39 +39,42 @@ namespace PepperDash.Essentials.Core.Config
|
||||
Name = dc.Name;
|
||||
Group = dc.Group;
|
||||
Type = dc.Type;
|
||||
Properties = JToken.FromObject(dc.Properties);
|
||||
|
||||
Properties = JToken.Parse(dc.Properties.ToString());
|
||||
|
||||
//Properties = JToken.FromObject(dc.Properties);
|
||||
}
|
||||
|
||||
public DeviceConfig() {}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DevicePropertiesConverter : JsonConverter
|
||||
{
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(JToken);
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
return JToken.ReadFrom(reader);
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException("SOD OFF HOSER");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DevicePropertiesConverter : JsonConverter
|
||||
{
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(JToken);
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
return JToken.ReadFrom(reader);
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException("SOD OFF HOSER");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device");
|
||||
Debug.Console(1, "Factory Attempting to create new DIN-CEN-CN2 Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipid = control.IpIdInt;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// Wrapper class for CEN-IO-DIGIN-104 digital input module
|
||||
/// </summary>
|
||||
[Description("Wrapper class for the CEN-IO-DIGIN-104 diginal input module")]
|
||||
public class CenIoDigIn104Controller : EssentialsDevice, IDigitalInputPorts
|
||||
public class CenIoDigIn104Controller : CrestronGenericBaseDevice, IDigitalInputPorts
|
||||
{
|
||||
public CenIoDi104 Di104 { get; private set; }
|
||||
|
||||
@@ -52,10 +52,17 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CEN-DIGIN-104 Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
var ipid = control.IpIdInt;
|
||||
|
||||
return new CenIoDigIn104Controller(dc.Key, dc.Name, new Crestron.SimplSharpPro.GeneralIO.CenIoDi104(ipid, Global.ControlSystem));
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
if (control == null)
|
||||
{
|
||||
Debug.Console(1, "Factory failed to create a new CEN-DIGIN-104 Device, control properties not found");
|
||||
return null;
|
||||
}
|
||||
var ipid = control.IpIdInt;
|
||||
if (ipid != 0) return new CenIoDigIn104Controller(dc.Key, dc.Name, new CenIoDi104(ipid, Global.ControlSystem));
|
||||
|
||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.GeneralIO;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Wrapper class for CEN-IO-IR-104 module
|
||||
/// </summary>
|
||||
[Description("Wrapper class for the CEN-IO-IR-104 module")]
|
||||
public class CenIoIr104Controller : CrestronGenericBaseDevice, IIROutputPorts
|
||||
{
|
||||
private readonly CenIoIr104 _ir104;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="ir104"></param>
|
||||
public CenIoIr104Controller(string key, string name, CenIoIr104 ir104)
|
||||
: base(key, name, ir104)
|
||||
{
|
||||
_ir104 = ir104;
|
||||
}
|
||||
|
||||
#region IDigitalInputPorts Members
|
||||
|
||||
/// <summary>
|
||||
/// IR port collection
|
||||
/// </summary>
|
||||
public CrestronCollection<IROutputPort> IROutputPorts
|
||||
{
|
||||
get { return _ir104.IROutputPorts; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Number of relay ports property
|
||||
/// </summary>
|
||||
public int NumberOfIROutputPorts
|
||||
{
|
||||
get { return _ir104.NumberOfIROutputPorts; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CEN-IO-IR-104 controller fatory
|
||||
/// </summary>
|
||||
public class CenIoIr104ControllerFactory : EssentialsDeviceFactory<CenIoIr104Controller>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public CenIoIr104ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "cenioir104" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build device CEN-IO-IR-104
|
||||
/// </summary>
|
||||
/// <param name="dc"></param>
|
||||
/// <returns></returns>
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new CEN-IO-IR-104 Device");
|
||||
|
||||
var control = CommFactory.GetControlPropertiesConfig(dc);
|
||||
if (control == null)
|
||||
{
|
||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device, control properties not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
var ipid = control.IpIdInt;
|
||||
if(ipid != 0) return new CenIoIr104Controller(dc.Key, dc.Name, new CenIoIr104(ipid, Global.ControlSystem));
|
||||
|
||||
Debug.Console(1, "Factory failed to create a new CEN-IO-IR-104 Device using IP-ID-{0}", ipid);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// Wrapper class for CEN-IO-RY-104 relay module
|
||||
/// </summary>
|
||||
[Description("Wrapper class for the CEN-IO-RY-104 relay module")]
|
||||
public class CenIoRy104Controller : EssentialsDevice, IRelayPorts
|
||||
public class CenIoRy104Controller : CrestronGenericBaseDevice, IRelayPorts
|
||||
{
|
||||
private readonly CenIoRy104 _ry104;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <param name="name"></param>
|
||||
/// <param name="ry104"></param>
|
||||
public CenIoRy104Controller(string key, string name, CenIoRy104 ry104)
|
||||
: base(key, name)
|
||||
: base(key, name, ry104)
|
||||
{
|
||||
_ry104 = ry104;
|
||||
}
|
||||
@@ -62,8 +62,8 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
var controlPropertiesConfig = CommFactory.GetControlPropertiesConfig(dc);
|
||||
if (controlPropertiesConfig == null)
|
||||
{
|
||||
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device");
|
||||
{
|
||||
Debug.Console(1, "Factory failed to create a new CEN-IO-RY-104 Device, control properties not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,25 +7,61 @@ using Crestron.SimplSharp;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines minimal volume control methods
|
||||
/// Defines minimal volume and mute control methods
|
||||
/// </summary>
|
||||
public interface IBasicVolumeControls
|
||||
public interface IBasicVolumeControls
|
||||
{
|
||||
void VolumeUp(bool pressRelease);
|
||||
void VolumeDown(bool pressRelease);
|
||||
void MuteToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines basic volume control methods
|
||||
/// </summary>
|
||||
public interface IHasVolumeControl
|
||||
{
|
||||
void VolumeUp(bool pressRelease);
|
||||
void VolumeDown(bool pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines volume control methods and properties with feedback
|
||||
/// </summary>
|
||||
public interface IHasVolumeControlWithFeedback : IHasVolumeControl
|
||||
{
|
||||
void SetVolume(ushort level);
|
||||
IntFeedback VolumeLevelFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines basic mute control methods
|
||||
/// </summary>
|
||||
public interface IHasMuteControl
|
||||
{
|
||||
void MuteToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines mute control methods and properties with feedback
|
||||
/// </summary>
|
||||
public interface IHasMuteControlWithFeedback : IHasMuteControl
|
||||
{
|
||||
BoolFeedback MuteFeedback { get; }
|
||||
void MuteOn();
|
||||
void MuteOff();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds feedback and direct volume level set to IBasicVolumeControls
|
||||
/// </summary>
|
||||
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
||||
public interface IBasicVolumeWithFeedback : IBasicVolumeControls
|
||||
{
|
||||
void SetVolume(ushort level);
|
||||
void MuteOn();
|
||||
void MuteOff();
|
||||
IntFeedback VolumeLevelFeedback { get; }
|
||||
BoolFeedback MuteFeedback { get; }
|
||||
void MuteOn();
|
||||
void MuteOff();
|
||||
void SetVolume(ushort level);
|
||||
IntFeedback VolumeLevelFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_Core.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for any device that is able to control it'spower and has a configurable reboot time
|
||||
/// </summary>
|
||||
public interface IHasPowerCycle : IKeyName, IHasPowerControlWithFeedback
|
||||
{
|
||||
/// <summary>
|
||||
/// Delay between power off and power on for reboot
|
||||
/// </summary>
|
||||
int PowerCycleTimeMs { get;}
|
||||
|
||||
/// <summary>
|
||||
/// Reboot outlet
|
||||
/// </summary>
|
||||
void PowerCycle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface for any device that contains a collection of IHasPowerReboot Devices
|
||||
/// </summary>
|
||||
public interface IHasControlledPowerOutlets : IKeyName
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection of IPduOutlets
|
||||
/// </summary>
|
||||
ReadOnlyDictionary<int, IHasPowerCycle> PduOutlets { get; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace PepperDash.Essentials.Core.Devices
|
||||
/// <summary>
|
||||
/// Used by the extending class to allow for any custom actions to be taken (tell the ConfigWriter to write config, etc)
|
||||
/// </summary>
|
||||
/// <param name="Config"></param>
|
||||
/// <param name="config"></param>
|
||||
protected virtual void CustomSetConfig(DeviceConfig config)
|
||||
{
|
||||
ConfigWriter.UpdateDeviceConfig(config);
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using PepperDash.Core;
|
||||
using Crestron.SimplSharpPro.CrestronThread;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class FileIO
|
||||
{
|
||||
|
||||
static CCriticalSection fileLock = new CCriticalSection();
|
||||
public delegate void GotFileEventHandler(object sender, FileEventArgs e);
|
||||
public static event GotFileEventHandler GotFileEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Get the full file info from a path/filename, can include wildcards.
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
public static FileInfo[] GetFiles(string fileName)
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
||||
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
||||
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
||||
if (files.Count() > 0)
|
||||
{
|
||||
return files;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static FileInfo GetFile(string fileName)
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(fileName));
|
||||
var files = dirInfo.GetFiles(Path.GetFileName(fileName));
|
||||
Debug.Console(0, "FileIO found: {0}, {1}", files.Count(), fileName);
|
||||
if (files.Count() > 0)
|
||||
{
|
||||
return files.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the data from string path/filename
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReadDataFromFile(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ReadDataFromFile(GetFile(fileName));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the data with fileInfo object
|
||||
/// </summary>
|
||||
/// <param name="fileName"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReadDataFromFile(FileInfo file)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (fileLock.TryEnter())
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
|
||||
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
||||
|
||||
if (File.Exists(file.FullName))
|
||||
{
|
||||
using (StreamReader r = new StreamReader(file.FullName))
|
||||
{
|
||||
return r.ReadToEnd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "File {0} does not exsist", file.FullName);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||
return "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fileLock != null && !fileLock.Disposed)
|
||||
fileLock.Leave();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void ReadDataFromFileASync(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadDataFromFileASync(GetFile(fileName));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadDataFromFileASync(FileInfo file)
|
||||
{
|
||||
try
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o => _ReadDataFromFileASync(file));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void _ReadDataFromFileASync(FileInfo file)
|
||||
{
|
||||
string data;
|
||||
try
|
||||
{
|
||||
if (fileLock.TryEnter())
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
|
||||
Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
|
||||
|
||||
|
||||
if (File.Exists(file.FullName))
|
||||
{
|
||||
using (StreamReader r = new StreamReader(file.FullName))
|
||||
{
|
||||
data = r.ReadToEnd();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(2, "File {0} Does not exsist", file.FullName);
|
||||
data = "";
|
||||
}
|
||||
GotFileEvent.Invoke(null, new FileEventArgs(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
|
||||
data = "";
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fileLock != null && !fileLock.Disposed)
|
||||
fileLock.Leave();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="filePath"></param>
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="filePath"></param>
|
||||
public static void WriteDataToFile(string data, string filePath)
|
||||
{
|
||||
Thread _WriteFileThread;
|
||||
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, filePath), null, Thread.eThreadStartOptions.CreateSuspended);
|
||||
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
|
||||
_WriteFileThread.Start();
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
|
||||
|
||||
}
|
||||
|
||||
static object _WriteFileMethod(string data, string filePath)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write file: '{0}'", filePath);
|
||||
|
||||
try
|
||||
{
|
||||
if (fileLock.TryEnter())
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(filePath))
|
||||
{
|
||||
sw.Write(data);
|
||||
sw.Flush();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO write failed: \r{0}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fileLock != null && !fileLock.Disposed)
|
||||
fileLock.Leave();
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool FileIoUnitTest()
|
||||
{
|
||||
var testData = "Testing FileIO";
|
||||
FileIO.WriteDataToFile(testData, "\\user\\FileIOTest.pdt");
|
||||
|
||||
var file = FileIO.GetFile("\\user\\*FileIOTest*");
|
||||
|
||||
var readData = FileIO.ReadDataFromFile(file);
|
||||
Debug.Console(0, "Returned {0}", readData);
|
||||
File.Delete(file.FullName);
|
||||
if (testData == readData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public class FileEventArgs
|
||||
{
|
||||
public FileEventArgs(string data) { Data = data; }
|
||||
public string Data { get; private set; } // readonly
|
||||
|
||||
}
|
||||
}
|
||||
@@ -92,50 +92,47 @@ namespace PepperDash.Essentials.Core.Lighting
|
||||
return LinkLightingToApi(lightingDevice, trilist, joinMap);
|
||||
}
|
||||
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, GenericLightingJoinMap joinMap)
|
||||
{
|
||||
protected GenericLightingJoinMap LinkLightingToApi(LightingBase lightingDevice, BasicTriList trilist, GenericLightingJoinMap joinMap)
|
||||
{
|
||||
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(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||
// GenericLighitng Actions & FeedBack
|
||||
trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||
|
||||
Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());
|
||||
var sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
|
||||
// GenericLighitng Actions & FeedBack
|
||||
trilist.SetUShortSigAction(joinMap.SelectScene.JoinNumber, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
|
||||
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + index), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[index]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)]);
|
||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
|
||||
var sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
sceneIndex++;
|
||||
}
|
||||
|
||||
trilist.SetSigTrueAction((uint)(joinMap.SelectSceneDirect.JoinNumber + index), () => lightingDevice.SelectScene(lightingDevice.LightingScenes[index]));
|
||||
scene.IsActiveFeedback.LinkInputSig(trilist.BooleanInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)]);
|
||||
trilist.StringInput[(uint)(joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint)(joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
|
||||
sceneIndex++;
|
||||
}
|
||||
sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
|
||||
trilist.OnlineStatusChange += (sender, args) =>
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
trilist.StringInput[(uint) (joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint) (joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
scene.IsActiveFeedback.FireUpdate();
|
||||
|
||||
sceneIndex = 0;
|
||||
foreach (var scene in lightingDevice.LightingScenes)
|
||||
{
|
||||
var index = sceneIndex;
|
||||
|
||||
trilist.StringInput[(uint) (joinMap.SelectSceneDirect.JoinNumber + index)].StringValue = scene.Name;
|
||||
trilist.BooleanInput[(uint) (joinMap.ButtonVisibility.JoinNumber + index)].BoolValue = true;
|
||||
scene.IsActiveFeedback.FireUpdate();
|
||||
|
||||
sceneIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
return joinMap;
|
||||
}
|
||||
sceneIndex++;
|
||||
}
|
||||
};
|
||||
|
||||
return joinMap;
|
||||
}
|
||||
}
|
||||
|
||||
public class LightingScene
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
<Compile Include="Bridges\IBridge.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\AirMediaControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\AppleTvJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\PduJoinMapBase.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\C2nRthsControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\CameraControllerJoinMap.cs" />
|
||||
<Compile Include="Bridges\JoinMaps\CenOdtOccupancySensorBaseJoinMap.cs" />
|
||||
@@ -183,6 +184,7 @@
|
||||
<Compile Include="Crestron IO\Inputs\GenericVersiportInputDevice.cs" />
|
||||
<Compile Include="Crestron IO\Inputs\IDigitalInput.cs" />
|
||||
<Compile Include="Crestron IO\IOPortConfig.cs" />
|
||||
<Compile Include="Crestron IO\Ir\CenIoIr104Controller.cs" />
|
||||
<Compile Include="Crestron IO\Relay\CenIoRy104Controller.cs" />
|
||||
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
|
||||
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
|
||||
@@ -203,6 +205,7 @@
|
||||
<Compile Include="Devices\IReconfigurableDevice.cs" />
|
||||
<Compile Include="Devices\PC\InRoomPc.cs" />
|
||||
<Compile Include="Devices\PC\Laptop.cs" />
|
||||
<Compile Include="Devices\PduInterfaces.cs" />
|
||||
<Compile Include="Devices\ReconfigurableDevice.cs" />
|
||||
<Compile Include="Devices\VolumeDeviceChangeEventArgs.cs" />
|
||||
<Compile Include="DeviceTypeInterfaces\IPasswordPrompt.cs" />
|
||||
@@ -224,6 +227,7 @@
|
||||
<Compile Include="Feedbacks\IntFeedback.cs" />
|
||||
<Compile Include="Feedbacks\SerialFeedback.cs" />
|
||||
<Compile Include="Feedbacks\StringFeedback.cs" />
|
||||
<Compile Include="File\FileIO.cs" />
|
||||
<Compile Include="Fusion\EssentialsHuddleSpaceFusionSystemControllerBase.cs" />
|
||||
<Compile Include="Fusion\FusionCustomPropertiesBridge.cs" />
|
||||
<Compile Include="Fusion\FusionEventHandlers.cs" />
|
||||
@@ -335,7 +339,9 @@
|
||||
<Compile Include="Feedbacks\BoolFeedbackPulseExtender.cs" />
|
||||
<Compile Include="Routing\RoutingPortNames.cs" />
|
||||
<Compile Include="Routing\TieLineConfig.cs" />
|
||||
<Compile Include="Secrets\CrestronSecretsProvider.cs" />
|
||||
<Compile Include="Secrets\CrestronGlobalSecretsProvider.cs" />
|
||||
<Compile Include="Secrets\CrestronLocalSecretsProvider.cs" />
|
||||
<Compile Include="Secrets\CrestronSecret.cs" />
|
||||
<Compile Include="Secrets\Interfaces.cs" />
|
||||
<Compile Include="Secrets\SecretsManager.cs" />
|
||||
<Compile Include="Secrets\SecretsPropertiesConfig.cs" />
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class CrestronGlobalSecretsProvider : ISecretProvider
|
||||
{
|
||||
public string Key { get; set; }
|
||||
//Added for reference
|
||||
public string Description { get; private set; }
|
||||
|
||||
public CrestronGlobalSecretsProvider(string key)
|
||||
{
|
||||
Key = key;
|
||||
Description = String.Format("Default secret provider serving all local applications");
|
||||
|
||||
}
|
||||
|
||||
static CrestronGlobalSecretsProvider()
|
||||
{
|
||||
//Added for future encrypted reference
|
||||
var secureSupported = CrestronSecureStorage.Supported;
|
||||
|
||||
CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (secureSupported)
|
||||
{
|
||||
//doThingsFuture
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <param name="value">Secret Value</param>
|
||||
public bool SetSecret(string key, object value)
|
||||
{
|
||||
var secret = value as string;
|
||||
CrestronDataStore.CDS_ERROR returnCode;
|
||||
|
||||
if (String.IsNullOrEmpty(secret))
|
||||
{
|
||||
returnCode = CrestronDataStoreStatic.clearGlobal(key);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully removed secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
returnCode = CrestronDataStoreStatic.SetGlobalStringValue(key, secret);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully set secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>ISecret Object containing key, provider, and value</returns>
|
||||
public ISecret GetSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
var getErrorCode = CrestronDataStoreStatic.GetGlobalStringValue(key, out mySecret);
|
||||
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a secret is present within the provider without retrieving it
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>bool if present</returns>
|
||||
public bool TestSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
return CrestronDataStoreStatic.GetGlobalStringValue(key, out mySecret) == CrestronDataStore.CDS_ERROR.CDS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,97 +1,103 @@
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class CrestronSecretsProvider : ISecretProvider
|
||||
{
|
||||
public string Key { get; set; }
|
||||
//Added for reference
|
||||
private static readonly bool SecureSupported;
|
||||
public CrestronSecretsProvider(string key)
|
||||
{
|
||||
Key = key;
|
||||
}
|
||||
|
||||
static CrestronSecretsProvider()
|
||||
{
|
||||
//Added for future encrypted reference
|
||||
SecureSupported = CrestronSecureStorage.Supported;
|
||||
|
||||
CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (SecureSupported)
|
||||
{
|
||||
//doThingsFuture
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <param name="value">Secret Value</param>
|
||||
public bool SetSecret(string key, object value)
|
||||
{
|
||||
var secret = value as string;
|
||||
if (String.IsNullOrEmpty(secret))
|
||||
{
|
||||
Debug.Console(2, this, "Unable to set secret for {0}:{1} - value is empty.", Key, key);
|
||||
return false;
|
||||
}
|
||||
var setErrorCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
||||
switch (setErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(1, this,"Secret Successfully Set for {0}:{1}", Key, key);
|
||||
return true;
|
||||
default:
|
||||
Debug.Console(2, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, setErrorCode.ToString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>ISecret Object containing key, provider, and value</returns>
|
||||
public ISecret GetSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
var getErrorCode = CrestronDataStoreStatic.GetLocalStringValue(key, out mySecret);
|
||||
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Special container class for CrestronSecret provider
|
||||
/// </summary>
|
||||
public class CrestronSecret : ISecret
|
||||
{
|
||||
public ISecretProvider Provider { get; private set; }
|
||||
public string Key { get; private set; }
|
||||
|
||||
public object Value { get; private set; }
|
||||
|
||||
public CrestronSecret(string key, string value, ISecretProvider provider)
|
||||
{
|
||||
Key = key;
|
||||
Value = value;
|
||||
Provider = provider;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharp.CrestronDataStore;
|
||||
using PepperDash.Core;
|
||||
using Crestron.SimplSharpPro;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public class CrestronLocalSecretsProvider : ISecretProvider
|
||||
{
|
||||
public string Key { get; set; }
|
||||
//Added for reference
|
||||
public string Description { get; private set; }
|
||||
|
||||
|
||||
public CrestronLocalSecretsProvider(string key)
|
||||
{
|
||||
Key = key;
|
||||
Description = String.Format("Default secret provider serving Essentials Application {0}", InitialParametersClass.ApplicationNumber);
|
||||
}
|
||||
|
||||
static CrestronLocalSecretsProvider()
|
||||
{
|
||||
//Added for future encrypted reference
|
||||
var secureSupported = CrestronSecureStorage.Supported;
|
||||
|
||||
CrestronDataStoreStatic.InitCrestronDataStore();
|
||||
if (secureSupported)
|
||||
{
|
||||
//doThingsFuture
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <param name="value">Secret Value</param>
|
||||
public bool SetSecret(string key, object value)
|
||||
{
|
||||
var secret = value as string;
|
||||
CrestronDataStore.CDS_ERROR returnCode;
|
||||
|
||||
if (String.IsNullOrEmpty(secret))
|
||||
{
|
||||
returnCode = CrestronDataStoreStatic.clearLocal(key);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully removed secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
returnCode = CrestronDataStoreStatic.SetLocalStringValue(key, secret);
|
||||
if (returnCode == CrestronDataStore.CDS_ERROR.CDS_SUCCESS)
|
||||
{
|
||||
Debug.Console(0, this, "Successfully set secret \"{0}\"", secret);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to set secret for {0}:{1} - {2}", Key, key, returnCode.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve secret for item in the CrestronSecretsProvider
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>ISecret Object containing key, provider, and value</returns>
|
||||
public ISecret GetSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
var getErrorCode = CrestronDataStoreStatic.GetLocalStringValue(key, out mySecret);
|
||||
|
||||
switch (getErrorCode)
|
||||
{
|
||||
case CrestronDataStore.CDS_ERROR.CDS_SUCCESS:
|
||||
Debug.Console(2, this, "Secret Successfully retrieved for {0}:{1}", Key, key);
|
||||
return new CrestronSecret(key, mySecret, this);
|
||||
default:
|
||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Unable to retrieve secret for {0}:{1} - {2}",
|
||||
Key, key, getErrorCode.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a secret is present within the provider without retrieving it
|
||||
/// </summary>
|
||||
/// <param name="key">Secret Key</param>
|
||||
/// <returns>bool if present</returns>
|
||||
public bool TestSecret(string key)
|
||||
{
|
||||
string mySecret;
|
||||
return CrestronDataStoreStatic.GetLocalStringValue(key, out mySecret) == CrestronDataStore.CDS_ERROR.CDS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Special container class for CrestronSecret provider
|
||||
/// </summary>
|
||||
public class CrestronSecret : ISecret
|
||||
{
|
||||
public ISecretProvider Provider { get; private set; }
|
||||
public string Key { get; private set; }
|
||||
|
||||
public object Value { get; private set; }
|
||||
|
||||
public CrestronSecret(string key, string value, ISecretProvider provider)
|
||||
{
|
||||
Key = key;
|
||||
Value = value;
|
||||
Provider = provider;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,9 +7,32 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public interface ISecretProvider : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Set secret value for provider by key
|
||||
/// </summary>
|
||||
/// <param name="key">key of secret to set</param>
|
||||
/// <param name="value">value to set secret to</param>
|
||||
/// <returns></returns>
|
||||
bool SetSecret(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// Return object containing secret from provider
|
||||
/// </summary>
|
||||
/// <param name="key">key of secret to retrieve</param>
|
||||
/// <returns></returns>
|
||||
ISecret GetSecret(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies presence of secret
|
||||
/// </summary>
|
||||
/// <param name="key">key of secret to chek</param>
|
||||
/// <returns></returns>
|
||||
bool TestSecret(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Description of the secrets provider
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -17,8 +40,19 @@ namespace PepperDash.Essentials.Core
|
||||
/// </summary>
|
||||
public interface ISecret
|
||||
{
|
||||
/// <summary>
|
||||
/// Instance of ISecretProvider that the secret belongs to
|
||||
/// </summary>
|
||||
ISecretProvider Provider { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Key of the secret in the provider
|
||||
/// </summary>
|
||||
string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Value of the secret
|
||||
/// </summary>
|
||||
object Value { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Crestron.SimplSharp;
|
||||
using PepperDash.Core;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public static class SecretsManager
|
||||
@@ -16,18 +16,28 @@ namespace PepperDash.Essentials.Core
|
||||
public static void Initialize()
|
||||
{
|
||||
|
||||
AddSecretProvider("default", new CrestronSecretsProvider("default"));
|
||||
AddSecretProvider("default", new CrestronLocalSecretsProvider("default"));
|
||||
|
||||
AddSecretProvider("CrestronGlobalSecrets", new CrestronGlobalSecretsProvider("CrestronGlobalSecrets"));
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(SetSecretProcess, "setsecret",
|
||||
"Adds secrets to secret provider",
|
||||
"Adds secret to secrets provider",
|
||||
ConsoleAccessLevelEnum.AccessOperator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(UpdateSecretProcess, "updatesecret",
|
||||
"Updates secrets in secret provider",
|
||||
"Updates secret in secrets provider",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(DeleteSecretProcess, "deletesecret",
|
||||
"Deletes secrets in secret provider",
|
||||
"Deletes secret from secrest provider",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(ListProviders, "secretproviderlist",
|
||||
"Return list of all valid secrets providers",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
|
||||
CrestronConsole.AddNewConsoleCommand(GetProviderInfo, "secretproviderinfo",
|
||||
"Return data about secrets provider",
|
||||
ConsoleAccessLevelEnum.AccessAdministrator);
|
||||
}
|
||||
|
||||
@@ -54,6 +64,79 @@ namespace PepperDash.Essentials.Core
|
||||
return secret;
|
||||
}
|
||||
|
||||
public static void GetProviderInfo(string cmd)
|
||||
{
|
||||
string response;
|
||||
var args = cmd.Split(' ');
|
||||
|
||||
if (cmd.Length == 0 || (args.Length == 1 && args[0] == "?"))
|
||||
{
|
||||
response = "Returns data about secrets provider. Format 'secretproviderinfo <provider>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (args.Length == 1)
|
||||
{
|
||||
var provider = GetSecretProviderByKey(args[0]);
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
response = "Invalid secrets provider key";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
response = String.Format("{0} : {1}", provider.Key, provider.Description);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
response = "Improper number of arguments";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Console Command that returns all valid secrets in the essentials program.
|
||||
/// </summary>
|
||||
/// <param name="cmd"></param>
|
||||
public static void ListProviders(string cmd)
|
||||
{
|
||||
var response = String.Empty;
|
||||
var args = cmd.Split(' ');
|
||||
|
||||
if (cmd.Length == 0)
|
||||
{
|
||||
if (Secrets != null && Secrets.Count > 0)
|
||||
{
|
||||
response = Secrets.Aggregate(response,
|
||||
(current, secretProvider) => current + (secretProvider.Key + "\n\r"));
|
||||
}
|
||||
else
|
||||
{
|
||||
response = "No Secrets Providers Available";
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Reports all valid and preset Secret providers";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
response = "Improper number of arguments";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add secret provider to secrets dictionary
|
||||
/// </summary>
|
||||
@@ -100,14 +183,14 @@ namespace PepperDash.Essentials.Core
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>";
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>";
|
||||
response = "Adds secrets to secret provider. Format 'setsecret <provider> <secretKey> <secret>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
@@ -134,23 +217,7 @@ namespace PepperDash.Essentials.Core
|
||||
var key = args[1];
|
||||
var secret = args[2];
|
||||
|
||||
if (provider.GetSecret(key) == null)
|
||||
{
|
||||
|
||||
response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
response =
|
||||
String.Format(
|
||||
"Unable to set secret for {0}:{1} - Please use the 'UpdateSecret' command to modify it");
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
CrestronConsole.ConsoleCommandResponse(SetSecret(provider, key, secret));
|
||||
}
|
||||
|
||||
private static void UpdateSecretProcess(string cmd)
|
||||
@@ -161,7 +228,7 @@ namespace PepperDash.Essentials.Core
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>";
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
@@ -169,7 +236,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>";
|
||||
response = "Updates secrets in secret provider. Format 'updatesecret <provider> <secretKey> <secret>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
@@ -198,23 +265,49 @@ namespace PepperDash.Essentials.Core
|
||||
var key = args[1];
|
||||
var secret = args[2];
|
||||
|
||||
if (provider.GetSecret(key) != null)
|
||||
{
|
||||
response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
CrestronConsole.ConsoleCommandResponse(UpdateSecret(provider, key, secret));
|
||||
|
||||
}
|
||||
|
||||
private static string UpdateSecret(ISecretProvider provider, string key, string secret)
|
||||
{
|
||||
var secretPresent = provider.TestSecret(key);
|
||||
|
||||
Debug.Console(2, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
|
||||
if (!secretPresent)
|
||||
return
|
||||
String.Format(
|
||||
"Unable to update secret for {0}:{1} - Please use the 'SetSecret' command to modify it");
|
||||
var response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
return response;
|
||||
}
|
||||
|
||||
private static string SetSecret(ISecretProvider provider, string key, string secret)
|
||||
{
|
||||
var secretPresent = provider.TestSecret(key);
|
||||
|
||||
Debug.Console(2, provider, "SecretsProvider {0} {1} contain a secret entry for {2}", provider.Key, secretPresent ? "does" : "does not", key);
|
||||
|
||||
if (secretPresent)
|
||||
return
|
||||
String.Format(
|
||||
"Unable to set secret for {0}:{1} - Please use the 'UpdateSecret' command to modify it");
|
||||
var response = provider.SetSecret(key, secret)
|
||||
? String.Format(
|
||||
"Secret successfully set for {0}:{1}",
|
||||
provider.Key, key)
|
||||
: String.Format(
|
||||
"Unable to set secret for {0}:{1}",
|
||||
provider.Key, key);
|
||||
return response;
|
||||
|
||||
response =
|
||||
String.Format(
|
||||
"Unable to update secret for {0}:{1} - Please use the 'SetSecret' command to create a new secret");
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
}
|
||||
|
||||
private static void DeleteSecretProcess(string cmd)
|
||||
@@ -225,14 +318,14 @@ namespace PepperDash.Essentials.Core
|
||||
if (args.Length == 0)
|
||||
{
|
||||
//some Instructional Text
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>";
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
|
||||
}
|
||||
if (args.Length == 1 && args[0] == "?")
|
||||
{
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>";
|
||||
response = "Deletes secrets in secret provider. Format 'deletesecret <provider> <secretKey>'";
|
||||
CrestronConsole.ConsoleCommandResponse(response);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace PepperDash.Essentials.Core
|
||||
public UShortOutputSig GetUShortOutputSig(uint index, uint sigNum)
|
||||
{
|
||||
if (sigNum > UShortIncrement) return null;
|
||||
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetBoolFeedbackSigName(index, sigNum)));
|
||||
return SRL.UShortOutput.FirstOrDefault(s => s.Name.Equals(GetUShortOutputSigName(index, sigNum)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -159,7 +159,7 @@ namespace PepperDash.Essentials.Core
|
||||
public StringOutputSig GetStringOutputSig(uint index, uint sigNum)
|
||||
{
|
||||
if (sigNum > StringIncrement) return null;
|
||||
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetBoolFeedbackSigName(index, sigNum)));
|
||||
return SRL.StringOutput.FirstOrDefault(s => s.Name.Equals(GetStringOutputSigName(index, sigNum)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
//Send((string)selector);
|
||||
}
|
||||
|
||||
void SetVolume(ushort level)
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
var levelString = string.Format("{0}{1:X4}\x03", VolumeLevelPartialCmd, level);
|
||||
AppendChecksumAndSend(levelString);
|
||||
@@ -333,10 +333,13 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
Send(MuteOnCmd);
|
||||
}
|
||||
|
||||
void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
||||
|
||||
/*
|
||||
public void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
||||
{
|
||||
SetVolume(level);
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
//Send((string)selector);
|
||||
}
|
||||
|
||||
void SetVolume(ushort level)
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
var levelString = string.Format("{0}{1:X3}\x03", VolumeLevelPartialCmd, level);
|
||||
|
||||
@@ -315,11 +315,12 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
Send(MuteOnCmd);
|
||||
}
|
||||
|
||||
/*
|
||||
void IBasicVolumeWithFeedback.SetVolume(ushort level)
|
||||
{
|
||||
SetVolume(level);
|
||||
}
|
||||
|
||||
*/
|
||||
#endregion
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
<Compile Include="Codec\eCodecCallStatus.cs" />
|
||||
<Compile Include="Codec\eMeetingPrivacy.cs" />
|
||||
<Compile Include="Codec\iCodecAudio.cs" />
|
||||
<Compile Include="VideoCodec\IConvertiblePreset.cs" />
|
||||
<Compile Include="Codec\IHasCallHold.cs" />
|
||||
<Compile Include="Codec\IHasDoNotDisturb.cs" />
|
||||
<Compile Include="Codec\IHasExternalSourceSwitching.cs" />
|
||||
|
||||
@@ -1023,20 +1023,25 @@ ConnectorID: {2}"
|
||||
if (tempPresets.Count > 0)
|
||||
{
|
||||
// Create temporary list to store the existing items from the CiscoCodecStatus.RoomPreset collection
|
||||
List<CiscoCodecStatus.RoomPreset> existingRoomPresets = new List<CiscoCodecStatus.RoomPreset>();
|
||||
var existingRoomPresets = new List<IConvertiblePreset>();
|
||||
// Add the existing items to the temporary list
|
||||
existingRoomPresets.AddRange(CodecStatus.Status.RoomPreset);
|
||||
// Populate the CodecStatus object (this will append new values to the RoomPreset collection
|
||||
JsonConvert.PopulateObject(response, CodecStatus);
|
||||
|
||||
JObject jResponse = JObject.Parse(response);
|
||||
var jResponse = JObject.Parse(response);
|
||||
|
||||
List<CiscoCodecStatus.RoomPreset> convertedRoomPresets =
|
||||
existingRoomPresets.Select(a => (CiscoCodecStatus.RoomPreset) a).ToList();
|
||||
|
||||
IList<JToken> roomPresets = jResponse["Status"]["RoomPreset"].Children().ToList();
|
||||
// Iterate the new items in this response agains the temporary list. Overwrite any existing items and add new ones.
|
||||
foreach (var preset in tempPresets)
|
||||
foreach (var camPreset in tempPresets)
|
||||
{
|
||||
var preset = camPreset as CiscoCodecStatus.RoomPreset;
|
||||
if (preset == null) continue;
|
||||
// First fine the existing preset that matches the id
|
||||
var existingPreset = existingRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id));
|
||||
var existingPreset = convertedRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id));
|
||||
if (existingPreset != null)
|
||||
{
|
||||
Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id);
|
||||
@@ -1068,7 +1073,7 @@ ConnectorID: {2}"
|
||||
CodecStatus.Status.RoomPreset = existingRoomPresets;
|
||||
|
||||
// Generecise the list
|
||||
NearEndPresets = RoomPresets.GetGenericPresets(CodecStatus.Status.RoomPreset);
|
||||
NearEndPresets = existingRoomPresets.GetGenericPresets<CodecRoomPreset>();
|
||||
|
||||
var handler = CodecRoomPresetsListHasChanged;
|
||||
if (handler != null)
|
||||
@@ -2465,20 +2470,6 @@ ConnectorID: {2}"
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a codec command that might need to have a friendly label applied for UI feedback purposes
|
||||
/// </summary>
|
||||
public class CodecCommandWithLabel
|
||||
{
|
||||
public string Command { get; set; }
|
||||
public string Label { get; set; }
|
||||
|
||||
public CodecCommandWithLabel(string command, string label)
|
||||
{
|
||||
Command = command;
|
||||
Label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracks the initial sycnronization state of the codec when making a connection
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
@@ -33,39 +28,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
public static class RoomPresets
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts Cisco RoomPresets to generic CameraPresets
|
||||
/// Converts non-generic RoomPresets to generic CameraPresets
|
||||
/// </summary>
|
||||
/// <param name="presets"></param>
|
||||
/// <returns></returns>
|
||||
public static List<CodecRoomPreset> GetGenericPresets(List<CiscoCodecStatus.RoomPreset> presets)
|
||||
public static List<T> GetGenericPresets<T>(this List<IConvertiblePreset> presets)
|
||||
{
|
||||
var cameraPresets = new List<CodecRoomPreset>();
|
||||
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Presets List:");
|
||||
}
|
||||
|
||||
foreach (CiscoCodecStatus.RoomPreset preset in presets)
|
||||
{
|
||||
try
|
||||
{
|
||||
var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true);
|
||||
|
||||
cameraPresets.Add(cameraPreset);
|
||||
|
||||
if (Debug.Level > 0)
|
||||
{
|
||||
Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e);
|
||||
}
|
||||
}
|
||||
|
||||
return cameraPresets;
|
||||
return
|
||||
presets.Select(preset => preset.ConvertCodecPreset())
|
||||
.Where(newPreset => newPreset != null)
|
||||
.Cast<T>()
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec;
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
{
|
||||
@@ -2185,7 +2186,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
}
|
||||
}
|
||||
|
||||
public class RoomPreset
|
||||
public class RoomPreset : IConvertiblePreset
|
||||
{
|
||||
public string id { get; set; }
|
||||
public Defined Defined { get; set; }
|
||||
@@ -2198,7 +2199,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
Description = new Description2();
|
||||
Type = new Type5();
|
||||
}
|
||||
}
|
||||
|
||||
public PresetBase ConvertCodecPreset()
|
||||
{
|
||||
try
|
||||
{
|
||||
var preset = new CodecRoomPreset(UInt16.Parse(id), Description.Value, Defined.BoolValue, true);
|
||||
|
||||
Debug.Console(2, "Preset ID {0} Converted from Cisco Codec Preset to Essentials Preset");
|
||||
|
||||
return preset;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", id, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2222,7 +2240,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
public Proximity Proximity { get; set; }
|
||||
public RoomAnalytics RoomAnalytics { get; set; }
|
||||
|
||||
public List<RoomPreset> RoomPreset { get; set; }
|
||||
public List<IConvertiblePreset> RoomPreset { get; set; }
|
||||
|
||||
public SIP SIP { get; set; }
|
||||
public Security Security { get; set; }
|
||||
@@ -2239,7 +2257,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
|
||||
Standby = new Standby();
|
||||
Cameras = new Cameras();
|
||||
RoomAnalytics = new RoomAnalytics();
|
||||
RoomPreset = new List<RoomPreset>();
|
||||
RoomPreset = new List<IConvertiblePreset>();
|
||||
Conference = new Conference2();
|
||||
SystemUnit = new SystemUnit();
|
||||
Video = new Video();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using PepperDash.Essentials.Core.Presets;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
public interface IConvertiblePreset
|
||||
{
|
||||
PresetBase ConvertCodecPreset();
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
void MinMaxLayoutToggle();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the required elements for layout control with direct layout selection
|
||||
/// </summary>
|
||||
public interface IHasCodecLayoutsAvailable : IHasCodecLayouts
|
||||
{
|
||||
|
||||
event EventHandler<AvailableLayoutChangedEventArgs> AvailableLayoutsChanged;
|
||||
|
||||
StringFeedback AvailableLocalLayoutsFeedback { get; }
|
||||
List<CodecCommandWithLabel> AvailableLocalLayouts { get; }
|
||||
void LocalLayoutSet(string layout);
|
||||
void LocalLayoutSet(CodecCommandWithLabel layout);
|
||||
|
||||
}
|
||||
|
||||
public class AvailableLayoutChangedEventArgs : EventArgs
|
||||
{
|
||||
public List<CodecCommandWithLabel> AvailableLayouts { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the requirements for Zoom Room layout control
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
using Crestron.SimplSharp.Reflection;
|
||||
using Crestron.SimplSharp.Ssh;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharp;
|
||||
@@ -370,6 +371,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
LinkVideoCodecCameraLayoutsToApi(codec as IHasCodecLayouts, trilist, joinMap);
|
||||
}
|
||||
|
||||
if (codec is IHasCodecLayoutsAvailable)
|
||||
{
|
||||
LinkVideoCodecAvailableLayoutsToApi(codec as IHasCodecLayoutsAvailable, trilist, joinMap);
|
||||
}
|
||||
|
||||
if (codec is IHasSelfviewPosition)
|
||||
{
|
||||
LinkVideoCodecSelfviewPositionToApi(codec as IHasSelfviewPosition, trilist, joinMap);
|
||||
@@ -457,10 +463,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
}
|
||||
|
||||
SharingContentIsOnFeedback.FireUpdate();
|
||||
|
||||
trilist.SetBool(joinMap.HookState.JoinNumber, IsInCall);
|
||||
|
||||
trilist.SetString(joinMap.CurrentCallData.JoinNumber, UpdateCallStatusXSig());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1010,7 +1012,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
|
||||
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
|
||||
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
|
||||
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
|
||||
|
||||
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
|
||||
|
||||
@@ -1025,7 +1027,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
|
||||
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
|
||||
var directoryXSig = UpdateDirectoryXSig(args.Directory, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
|
||||
var directoryXSig = UpdateDirectoryXSig(args.Directory, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
|
||||
|
||||
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
|
||||
|
||||
@@ -1036,10 +1038,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
|
||||
// TODO [ ] Issue #868
|
||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, "\xFC");
|
||||
UpdateDirectoryXSig(codec.CurrentDirectoryResult,
|
||||
!codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
|
||||
var clearBytes = XSigHelpers.ClearOutputs();
|
||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
|
||||
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
|
||||
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
|
||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1180,31 +1183,44 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
|
||||
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
|
||||
{
|
||||
var contactIndex = 1;
|
||||
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count];
|
||||
var xSigMaxIndex = 1023;
|
||||
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count > xSigMaxIndex
|
||||
? xSigMaxIndex
|
||||
: directory.CurrentDirectoryResults.Count];
|
||||
|
||||
Debug.Console(2, this, "Is root {0} Directory Count: {1}", isRoot, directory.CurrentDirectoryResults.Count);
|
||||
Debug.Console(2, this, "IsRoot: {0}, Directory Count: {1}, TokenArray.Length: {2}", isRoot, directory.CurrentDirectoryResults.Count, tokenArray.Length);
|
||||
|
||||
foreach (var entry in directory.CurrentDirectoryResults)
|
||||
var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex
|
||||
? directory.CurrentDirectoryResults.Take(xSigMaxIndex)
|
||||
: directory.CurrentDirectoryResults;
|
||||
|
||||
var contactsToDisplay = isRoot
|
||||
? contacts.Where(c => c.ParentFolderId == "root")
|
||||
: contacts.Where(c => c.ParentFolderId != "root");
|
||||
|
||||
var counterIndex = 1;
|
||||
foreach (var entry in contactsToDisplay)
|
||||
{
|
||||
var arrayIndex = contactIndex - 1;
|
||||
var arrayIndex = counterIndex - 1;
|
||||
var entryIndex = counterIndex;
|
||||
|
||||
Debug.Console(2, this, "Entry Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId);
|
||||
Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}, Type: {3}, ParentFolderId: {4}",
|
||||
entry.Name, entry.FolderId, entryIndex, entry.GetType().GetCType().FullName, entry.ParentFolderId);
|
||||
|
||||
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
|
||||
if (entry is DirectoryFolder)
|
||||
{
|
||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name));
|
||||
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
|
||||
|
||||
contactIndex++;
|
||||
counterIndex++;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name);
|
||||
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, entry.Name);
|
||||
|
||||
contactIndex++;
|
||||
counterIndex++;
|
||||
}
|
||||
|
||||
|
||||
return GetXSigString(tokenArray);
|
||||
}
|
||||
|
||||
@@ -1346,9 +1362,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
{
|
||||
if (!args.DeviceOnLine) return;
|
||||
|
||||
// TODO [ ] Issue #868
|
||||
// TODO [ ] #983
|
||||
Debug.Console(0, this, "LinkVideoCodecCallControlsToApi: device is {0}, IsInCall {1}", args.DeviceOnLine ? "online" : "offline", IsInCall);
|
||||
trilist.SetBool(joinMap.HookState.JoinNumber, IsInCall);
|
||||
trilist.SetString(joinMap.CurrentCallData.JoinNumber, "\xFC");
|
||||
UpdateCallStatusXSig();
|
||||
trilist.SetString(joinMap.CurrentCallData.JoinNumber, UpdateCallStatusXSig());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1471,6 +1489,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
codec.LocalLayoutFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentLayoutStringFb.JoinNumber]);
|
||||
}
|
||||
|
||||
private void LinkVideoCodecAvailableLayoutsToApi(IHasCodecLayoutsAvailable codec, BasicTriList trilist,
|
||||
VideoCodecControllerJoinMap joinMap)
|
||||
{
|
||||
codec.AvailableLocalLayoutsFeedback.LinkInputSig(trilist.StringInput[joinMap.AvailableLayoutsFb.JoinNumber]);
|
||||
|
||||
trilist.SetStringSigAction(joinMap.SelectLayout.JoinNumber, codec.LocalLayoutSet);
|
||||
}
|
||||
|
||||
private void LinkVideoCodecCameraModeToApi(IHasCameraAutoMode codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
|
||||
{
|
||||
trilist.SetSigFalseAction(joinMap.CameraModeAuto.JoinNumber, codec.CameraAutoModeOn);
|
||||
@@ -1982,4 +2008,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Represents a codec command that might need to have a friendly label applied for UI feedback purposes
|
||||
/// </summary>
|
||||
public class CodecCommandWithLabel
|
||||
{
|
||||
public string Command { get; private set; }
|
||||
public string Label { get; private set; }
|
||||
|
||||
public CodecCommandWithLabel(string command, string label)
|
||||
{
|
||||
Command = command;
|
||||
Label = label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2729,7 +2729,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
{
|
||||
Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count);
|
||||
|
||||
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
|
||||
|
||||
var directoryResult = result;
|
||||
var directoryIsRoot = CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false;
|
||||
|
||||
// If result is Root, create a copy and filter out contacts whose parent folder is not root
|
||||
//if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue)
|
||||
@@ -2747,7 +2750,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
//}
|
||||
|
||||
Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}",
|
||||
!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue, directoryResult.Contacts.Count);
|
||||
directoryIsRoot, directoryResult.Contacts.Count);
|
||||
|
||||
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
|
||||
var handler = DirectoryResultReturned;
|
||||
@@ -2756,11 +2759,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
|
||||
handler(this, new DirectoryEventArgs
|
||||
{
|
||||
Directory = directoryResult,
|
||||
DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue
|
||||
DirectoryIsOnRoot = directoryIsRoot
|
||||
});
|
||||
}
|
||||
|
||||
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user