Skip to content

Commit

Permalink
Merge pull request #97 from PepperDash-Engineering/feature/Usb-Enhanc…
Browse files Browse the repository at this point in the history
…ements

Feature/usb enhancements
  • Loading branch information
ngenovese11 authored Jan 30, 2023
2 parents dc1aa9d + 89f371b commit 3f82618
Show file tree
Hide file tree
Showing 17 changed files with 466 additions and 311 deletions.
3 changes: 3 additions & 0 deletions src/NvxEpi/Devices/Nvx35x.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Streaming;
using Newtonsoft.Json;
using NvxEpi.Abstractions;
using NvxEpi.Abstractions.HdmiInput;
using NvxEpi.Abstractions.HdmiOutput;
Expand Down Expand Up @@ -55,6 +56,8 @@ public override bool CustomActivate()

Hardware = hardware;
var result = base.CustomActivate();
//if (Debug.Level >= 0)
// Debug.Console(0, this, "{0}", JsonConvert.SerializeObject(_config, Formatting.Indented));

_usbStream = UsbStream.GetUsbStream(this, _config.Usb);
_hdmiInput = new HdmiInput2(this);
Expand Down
37 changes: 21 additions & 16 deletions src/NvxEpi/Devices/Nvx36X.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,27 @@ public Nvx36X(DeviceConfig config, Func<DmNvxBaseClass> getHardware, bool isTran

public override bool CustomActivate()
{
var hardware = base.Hardware as DmNvx36x;
if (hardware == null)
throw new Exception("hardware built doesn't match");

Hardware = hardware;
var result = base.CustomActivate();

_usbStream = UsbStream.GetUsbStream(this, _config.Usb);
_hdmiInput = new HdmiInput1(this);
_hdmiOutput = new VideowallModeOutput(this);

if (_config.EnableAutoRoute)
// ReSharper disable once ObjectCreationAsStatement
new AutomaticInputRouter(_hdmiInput);

return result;
try
{

Hardware = base.Hardware as DmNvx36x;
var result = base.CustomActivate();

_usbStream = UsbStream.GetUsbStream(this, _config.Usb);
_hdmiInput = new HdmiInput1(this);
_hdmiOutput = new VideowallModeOutput(this);

if (_config.EnableAutoRoute)
// ReSharper disable once ObjectCreationAsStatement
new AutomaticInputRouter(_hdmiInput);

return result;
}
catch (Exception ex)
{
Debug.Console(0, this, "Caught an exception in activate:{0}", ex);
throw;
}
}

public CrestronCollection<ComPort> ComPorts
Expand Down
2 changes: 2 additions & 0 deletions src/NvxEpi/Factories/Nvx36XDeviceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public Nvx36XDeviceFactory()
"dmnvx360c",
"dmnvx363",
"dmnvx363c",
"dmnvxe760",
"dmnvxe760c",
};
}

Expand Down
34 changes: 34 additions & 0 deletions src/NvxEpi/Factories/NvxBaseDeviceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,40 @@ protected static Func<DmNvxBaseClass> GetDeviceBuildAction(string type, NvxDevic
: new DmNvxE31C((uint)props.DeviceId, xio.Hardware.Domain.Values.FirstOrDefault());
};
}
case "dmnvxe760":
{
if (string.IsNullOrEmpty(props.ParentDeviceKey) ||
props.ParentDeviceKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
{
return () => new DmNvxE760(props.Control.IpIdInt, Global.ControlSystem);
}
return () =>
{
var xio = GetDirector(props.ParentDeviceKey);
DmXioDirectorBase.DmXioDomain domain;

return xio.Hardware.Domain.TryGetValue(props.DomainId, out domain)
? new DmNvxE760((uint)props.DeviceId, domain)
: new DmNvxE760((uint)props.DeviceId, xio.Hardware.Domain.Values.FirstOrDefault());
};
}
case "dmnvxe760c":
{
if (string.IsNullOrEmpty(props.ParentDeviceKey) ||
props.ParentDeviceKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
{
return () => new DmNvxE760(props.Control.IpIdInt, Global.ControlSystem);
}
return () =>
{
var xio = GetDirector(props.ParentDeviceKey);
DmXioDirectorBase.DmXioDomain domain;

return xio.Hardware.Domain.TryGetValue(props.DomainId, out domain)
? new DmNvxE760((uint)props.DeviceId, domain)
: new DmNvxE760((uint)props.DeviceId, xio.Hardware.Domain.Values.FirstOrDefault());
};
}
default:
throw new NotSupportedException(type);
}
Expand Down
1 change: 1 addition & 0 deletions src/NvxEpi/Features/Config/NvxDeviceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ public class NvxUsbProperties
public string Mode { get; set; }
public string Default { get; set; }
public bool FollowVideo { get; set; }
public bool IsLayer3 { get; set; }
}
}
14 changes: 10 additions & 4 deletions src/NvxEpi/Features/Hdmi/Input/HdmiInput1.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NvxEpi.Abstractions;
using Crestron.SimplSharpPro.DM.Streaming;
using NvxEpi.Abstractions;
using NvxEpi.Services.Feedback;
using PepperDash.Core;
using PepperDash.Essentials.Core;

namespace NvxEpi.Features.Hdmi.Input
Expand All @@ -10,10 +10,16 @@ public class HdmiInput1 : HdmiInputBase
public HdmiInput1(INvxDeviceWithHardware device)
: base(device)
{
var capability = Hdmi1HdcpCapabilityValueFeedback.GetFeedback(device.Hardware);
var capability = (device.Hardware is DmNvxE760x)
? DmHdcpCapabilityValueFeedback.GetFeedback(device.Hardware)
: Hdmi1HdcpCapabilityValueFeedback.GetFeedback(device.Hardware);

_capability.Add(1, capability);

var sync = Hdmi1SyncDetectedFeedback.GetFeedback(device.Hardware);
var sync = (device.Hardware is DmNvxE760x)
? DmSyncDetectedFeedback.GetFeedback(device.Hardware)
: Hdmi1SyncDetectedFeedback.GetFeedback(device.Hardware);

_sync.Add(1, sync);

//TODO
Expand Down
Loading

0 comments on commit 3f82618

Please sign in to comment.