Merge pull request #1075 from PepperDash/feature/AM3200

Add support for Crestron AM3200
This commit is contained in:
Andrew Welker
2023-03-22 11:35:52 -06:00
committed by GitHub
3 changed files with 181 additions and 139 deletions

View File

@@ -94,7 +94,7 @@
</Reference> </Reference>
<Reference Include="SimplSharpCWSHelperInterface, Version=2.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL"> <Reference Include="SimplSharpCWSHelperInterface, Version=2.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCWSHelperInterface.dll</HintPath> <HintPath>..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCWSHelperInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL"> <Reference Include="SimplSharpHelperInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM.AirMedia
[Description("Wrapper class for an AM-200 or AM-300")] [Description("Wrapper class for an AM-200 or AM-300")]
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts
{ {
public AmX00 AirMedia { get; private set; } public Am3x00 AirMedia { get; private set; }
public DeviceConfig DeviceConfig { get; private set; } public DeviceConfig DeviceConfig { get; private set; }
@@ -44,7 +44,7 @@ namespace PepperDash.Essentials.DM.AirMedia
public StringFeedback SerialNumberFeedback { get; private set; } public StringFeedback SerialNumberFeedback { get; private set; }
public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; } public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; }
public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props) public AirMediaController(string key, string name, Am3x00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
: base(key, name, device) : base(key, name, device)
{ {
@@ -95,24 +95,31 @@ namespace PepperDash.Essentials.DM.AirMedia
AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange); AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);
IsInSessionFeedback = new BoolFeedback(new Func<bool>(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0)); IsInSessionFeedback = new BoolFeedback(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0);
ErrorFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.ErrorFeedback.UShortValue)); ErrorFeedback = new IntFeedback(() => AirMedia.AirMedia.ErrorFeedback.UShortValue);
NumberOfUsersConnectedFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue)); NumberOfUsersConnectedFeedback = new IntFeedback(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue);
LoginCodeFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue)); LoginCodeFeedback = new IntFeedback(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue);
ConnectionAddressFeedback = new StringFeedback(new Func<string>(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue)); ConnectionAddressFeedback = new StringFeedback(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue);
HostnameFeedback = new StringFeedback(new Func<string>(() => AirMedia.AirMedia.HostNameFeedback.StringValue)); HostnameFeedback = new StringFeedback(() => AirMedia.AirMedia.HostNameFeedback.StringValue);
// TODO: Figure out if we can actually get the TSID/Serial // TODO: Figure out if we can actually get the TSID/Serial
SerialNumberFeedback = new StringFeedback(new Func<string>(() => "unknown")); SerialNumberFeedback = new StringFeedback(() => "unknown");
AirMedia.DisplayControl.DisplayControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(DisplayControl_DisplayControlChange); AirMedia.DisplayControl.DisplayControlChange += DisplayControl_DisplayControlChange;
VideoOutFeedback = new IntFeedback(new Func<int>(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback))); VideoOutFeedback = new IntFeedback(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback));
AutomaticInputRoutingEnabledFeedback = new BoolFeedback(new Func<bool>(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue)); AutomaticInputRoutingEnabledFeedback = new BoolFeedback(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue);
AirMedia.HdmiIn.StreamChange += new Crestron.SimplSharpPro.DeviceSupport.StreamEventHandler(HdmiIn_StreamChange); // Not all AirMedia versions support HDMI In like the 3200
if (AirMedia.HdmiIn != null)
{
AirMedia.HdmiIn.StreamChange += HdmiIn_StreamChange;
HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue);
return;
}
HdmiVideoSyncDetectedFeedback = new BoolFeedback(new Func<bool>(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue)); // Return false if the AirMedia device doesn't support HDMI Input
HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => false);
} }
public override bool CustomActivate() public override bool CustomActivate()
@@ -122,7 +129,7 @@ namespace PepperDash.Essentials.DM.AirMedia
else else
AirMedia.DisplayControl.DisableAutomaticRouting(); AirMedia.DisplayControl.DisableAutomaticRouting();
return base.CustomActivate(); return true;
} }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
@@ -179,30 +186,52 @@ namespace PepperDash.Essentials.DM.AirMedia
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param> /// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
private void OnSwitchChange(RoutingNumericEventArgs e) private void OnSwitchChange(RoutingNumericEventArgs e)
{ {
var newEvent = NumericSwitchChange; var handler = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
if (handler == null) return;
handler(this, e);
} }
void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{ {
if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId) switch (args.EventId)
{
case AirMediaInputSlot.AirMediaStatusFeedbackEventId:
{
IsInSessionFeedback.FireUpdate(); IsInSessionFeedback.FireUpdate();
else if (args.EventId == AirMediaInputSlot.AirMediaErrorFeedbackEventId) break;
}
case AirMediaInputSlot.AirMediaErrorFeedbackEventId:
{
ErrorFeedback.FireUpdate(); ErrorFeedback.FireUpdate();
else if (args.EventId == AirMediaInputSlot.AirMediaNumberOfUserConnectedEventId) break;
}
case AirMediaInputSlot.AirMediaNumberOfUserConnectedEventId:
{
NumberOfUsersConnectedFeedback.FireUpdate(); NumberOfUsersConnectedFeedback.FireUpdate();
else if (args.EventId == AirMediaInputSlot.AirMediaLoginCodeEventId) break;
}
case AirMediaInputSlot.AirMediaLoginCodeEventId:
{
LoginCodeFeedback.FireUpdate(); LoginCodeFeedback.FireUpdate();
else if (args.EventId == AirMediaInputSlot.AirMediaConnectionAddressFeedbackEventId) break;
}
case AirMediaInputSlot.AirMediaConnectionAddressFeedbackEventId:
{
ConnectionAddressFeedback.FireUpdate(); ConnectionAddressFeedback.FireUpdate();
else if (args.EventId == AirMediaInputSlot.AirMediaHostNameFeedbackEventId) break;
}
case AirMediaInputSlot.AirMediaHostNameFeedbackEventId:
{
HostnameFeedback.FireUpdate(); HostnameFeedback.FireUpdate();
break;
}
}
} }
void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{
if (args.EventId == AmX00.VideoOutFeedbackEventId)
{ {
VideoOutFeedback.FireUpdate(); VideoOutFeedback.FireUpdate();
@@ -211,8 +240,7 @@ namespace PepperDash.Essentials.DM.AirMedia
OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(), OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(),
localInputPort, eRoutingSignalType.AudioVideo)); localInputPort, eRoutingSignalType.AudioVideo));
}
else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId)
AutomaticInputRoutingEnabledFeedback.FireUpdate(); AutomaticInputRoutingEnabledFeedback.FireUpdate();
} }
@@ -342,7 +370,7 @@ namespace PepperDash.Essentials.DM.AirMedia
{ {
public AirMediaControllerFactory() public AirMediaControllerFactory()
{ {
TypeNames = new List<string>() { "am200", "am300" }; TypeNames = new List<string>() { "am200", "am300", "am3200" };
} }
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)
@@ -351,12 +379,26 @@ namespace PepperDash.Essentials.DM.AirMedia
Debug.Console(1, "Factory Attempting to create new AirMedia Device"); Debug.Console(1, "Factory Attempting to create new AirMedia Device");
var props = JsonConvert.DeserializeObject<AirMediaPropertiesConfig>(dc.Properties.ToString()); var props = dc.Properties.ToObject<AirMediaPropertiesConfig>();
AmX00 amDevice = null; Am3x00 amDevice = null;
if (type == "am200") switch (type)
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem); {
else if (type == "am300") case "am200" :
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem); {
amDevice = new Am200(props.Control.IpIdInt, Global.ControlSystem);
break;
}
case "am300" :
{
amDevice = new Am300(props.Control.IpIdInt, Global.ControlSystem);
break;
}
case "am3200" :
{
amDevice = new Am3200(props.Control.IpIdInt, Global.ControlSystem);
break;
}
}
return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props); return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props);