Skip to content

Commit

Permalink
Merge branch 'main' into hotfix/add-hdcp-control-to-airmedia
Browse files Browse the repository at this point in the history
  • Loading branch information
jtalborough authored May 16, 2024
2 parents 3d760cb + 12e81af commit 78e4987
Show file tree
Hide file tree
Showing 20 changed files with 1,828 additions and 95 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ we receive and the availability of resources to evaluate contributions, we antic
project remains dynamic and relevant. This may affect our responsiveness and ability to accept pull requests
quickly. This does not mean we are ignoring them.
- Not all innovative ideas need to be accepted as pull requests into this GitHub project to be valuable to the community.
There may be times when we recommend that you just share your code for some enhancement to Ghidra from your own
repository. As we identify and recognize extensions that are of general interest to the reverse engineering community, we
There may be times when we recommend that you just share your code for some enhancement to Essentials from your own
repository. As we identify and recognize extensions that are of general interest to Essentials, we
may seek to incorporate them with our baseline.

## Legal
Expand Down
2 changes: 1 addition & 1 deletion PepperDashEssentials/Bridges/EiscBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public EiscApi(DeviceConfig dc) :
catch (NullReferenceException)
{
Debug.ConsoleWithLog(0, this,
"Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key);
"Please update the bridge config to use eiscApiAdvanced with this device: {0}", device.Key);
}
}
Debug.Console(1, this, "Devices Linked.");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
using System;
using PepperDash.Essentials.Core;

namespace PepperDash_Essentials_Core.Bridges
{
public class HdPsXxxControllerJoinMap : JoinMapBaseAdvanced
{

#region Digital

[JoinName("EnableAutoRoute")]
public JoinDataComplete EnableAutoRoute = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Enable Automatic Routing on Xx1 Switchers",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Digital
});


[JoinName("InputSync")]
public JoinDataComplete InputSync = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 8
},
new JoinMetadata
{
Description = "Device Input Sync",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});


[JoinName("EnableInputHdcp")]
public JoinDataComplete EnableInputHdcp = new JoinDataComplete(
new JoinData
{
JoinNumber = 11,
JoinSpan = 8
},
new JoinMetadata
{
Description = "Device Enable Input Hdcp",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Digital
});


[JoinName("DisableInputHdcp")]
public JoinDataComplete DisableInputHdcp = new JoinDataComplete(
new JoinData
{
JoinNumber = 21,
JoinSpan = 8
},
new JoinMetadata
{
Description = "Device Disnable Input Hdcp",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Digital
});


[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(
new JoinData
{
JoinNumber = 30,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Device Onlne",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});

#endregion


#region Analog

[JoinName("OutputRoute")]
public JoinDataComplete OutputRoute = new JoinDataComplete(
new JoinData
{
JoinNumber = 11,
JoinSpan = 2
},
new JoinMetadata
{
Description = "Device Output Route Set/Get",
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});

#endregion


#region Serial

[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(
new JoinData
{
JoinNumber = 1,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Device Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});


[JoinName("InputName")]
public JoinDataComplete InputName = new JoinDataComplete(
new JoinData
{
JoinNumber = 2,
JoinSpan = 8
},
new JoinMetadata
{
Description = "Device Input Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});


[JoinName("OutputName")]
public JoinDataComplete OutputName = new JoinDataComplete(
new JoinData
{
JoinNumber = 11,
JoinSpan = 2
},
new JoinMetadata
{
Description = "Device Output Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});


[JoinName("OutputRoutedName")]
public JoinDataComplete OutputRoutedName = new JoinDataComplete(
new JoinData
{
JoinNumber = 16,
JoinSpan = 2
},
new JoinMetadata
{
Description = "Device Output Route Name",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});


#endregion

/// <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 HdPsXxxControllerJoinMap(uint joinStart)
: this(joinStart, typeof(HdPsXxxControllerJoinMap))
{
}

/// <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>
protected HdPsXxxControllerJoinMap(uint joinStart, Type type)
: base(joinStart, type)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,41 +124,54 @@ public static ComPort GetComPort(EssentialsControlPropertiesConfig config)
/// <returns></returns>
public static ICec GetCecPort(ControlPropertiesConfig config)
{
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);
try
{
var dev = DeviceManager.GetDeviceForKey(config.ControlPortDevKey);

if (dev != null)
{
if (!String.IsNullOrEmpty(config.ControlPortName))
{
Debug.Console(0, "GetCecPort: device '{0}' {1}", config.ControlPortDevKey, dev == null
? "is not valid, failed to get cec port"
: "found in device manager, attempting to get cec port");

var inputPort = (dev as IRoutingInputsOutputs).InputPorts[config.ControlPortName];
if (dev == null)
return null;

if (inputPort != null)
{
if (inputPort.Port is ICec)
return inputPort.Port as ICec;
}
if (String.IsNullOrEmpty(config.ControlPortName))
{
Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
return null;
}

var outputPort = (dev as IRoutingInputsOutputs).OutputPorts[config.ControlPortName];

if (outputPort != null)
{
if (outputPort.Port is ICec)
return outputPort.Port as ICec;
}
var inputsOutputs = dev as IRoutingInputsOutputs;
if (inputsOutputs == null)
{
Debug.Console(0, "GetCecPort: Device '{0}' does not support IRoutingInputsOutputs, failed to get CEC port called '{1}'",
config.ControlPortDevKey, config.ControlPortName);

else
Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called: '{1}'",
config.ControlPortDevKey, config.ControlPortName);
}
else
{
Debug.Console(0, "GetCecPort: '{0}' - Configuration missing 'ControlPortName'", config.ControlPortDevKey);
}
}
Debug.Console(0, "GetCecPort: Device '{0}' is not a valid device.", config.ControlPortDevKey);
return null;
}

var inputPort = inputsOutputs.InputPorts[config.ControlPortName];
if (inputPort != null && inputPort.Port is ICec)
return inputPort.Port as ICec;


var outputPort = inputsOutputs.OutputPorts[config.ControlPortName];
if (outputPort != null && outputPort.Port is ICec)
return outputPort.Port as ICec;
}
catch (Exception ex)
{
Debug.Console(1, "GetCecPort Exception Message: {0}", ex.Message);
Debug.Console(2, "GetCecPort Exception StackTrace: {0}", ex.StackTrace);
if (ex.InnerException != null)
Debug.Console(0, "GetCecPort Exception InnerException: {0}", ex.InnerException);
}

return null;
Debug.Console(0, "GetCecPort: Device '{0}' does not have a CEC port called '{1}'",
config.ControlPortDevKey, config.ControlPortName);

return null;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;

namespace PepperDash.Essentials.Core.CrestronIO
{
/// <summary>
/// Wrapper class for CEN-IO-COM-Xxx expander module
/// </summary>
[Description("Wrapper class for the CEN-IO-COM-102 & CEN-IO-COM-202 expander module")]
public class CenIoComController : CrestronGenericBaseDevice, IComPorts
{
private readonly CenIoCom _cenIoCom;

public CenIoComController(string key, string name, CenIoCom cenIo)
:base(key, name, cenIo)
{
_cenIoCom = cenIo;
}

#region Implementation of IComPorts

public CrestronCollection<ComPort> ComPorts
{
get { return _cenIoCom.ComPorts; }
}

public int NumberOfComPorts
{
get { return _cenIoCom.NumberOfComPorts; }
}

#endregion

}

public class CenIoCom102ControllerFactory : EssentialsDeviceFactory<CenIoComController>
{
private const string CenIoCom102Type = "ceniocom102";
private const string CenIoCom202Type = "ceniocom202";

public CenIoCom102ControllerFactory()
{
TypeNames = new List<string> { CenIoCom102Type, CenIoCom202Type };
}

public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-IO-COM-Xxx Device");

var control = CommFactory.GetControlPropertiesConfig(dc);
if (control == null)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, control properties not found");
return null;
}

var ipid = control.IpIdInt;
if (ipid < 2)
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid IP-ID found");
return null;
}

switch (dc.Type)
{
case CenIoCom102Type:
{
return new CenIoComController(dc.Key, dc.Name, new CenIoCom102(ipid, Global.ControlSystem));
}
case CenIoCom202Type:
{
return new CenIoComController(dc.Key, dc.Name, new CenIoCom202(ipid, Global.ControlSystem));
}
default:
{
Debug.Console(1, "Factory failed to create a new CEN-IO-COM-Xxx Device, invalid type '{0}'", dc.Type);
return null;
}
}
}
}
}
Loading

0 comments on commit 78e4987

Please sign in to comment.