mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Updates to complete SamsungMDC driver addition
This commit is contained in:
@@ -1,99 +1,110 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
using Crestron.SimplSharpPro.DM.Endpoints;
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling
|
public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling
|
||||||
{
|
{
|
||||||
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
public BoolFeedback PowerIsOnFeedback { get; protected set; }
|
||||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||||
|
|
||||||
public uint WarmupTime { get; set; }
|
public uint WarmupTime { get; set; }
|
||||||
public uint CooldownTime { get; set; }
|
public uint CooldownTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
|
||||||
/// by concrete sub-classes
|
/// by concrete sub-classes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
|
||||||
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
|
||||||
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
|
||||||
|
|
||||||
protected CTimer WarmupTimer;
|
|
||||||
protected CTimer CooldownTimer;
|
protected CTimer WarmupTimer;
|
||||||
|
protected CTimer CooldownTimer;
|
||||||
#region IRoutingInputs Members
|
|
||||||
|
#region IRoutingInputs Members
|
||||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
|
||||||
|
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||||
#endregion
|
|
||||||
|
#endregion
|
||||||
public DisplayBase(string key, string name)
|
|
||||||
: base(key, name)
|
public DisplayBase(string key, string name)
|
||||||
{
|
: base(key, name)
|
||||||
PowerIsOnFeedback = new BoolFeedback(CommonBoolCue.PowerOnFeedback, PowerIsOnFeedbackFunc);
|
{
|
||||||
IsCoolingDownFeedback = new BoolFeedback(CommonBoolCue.IsCoolingDown, IsCoolingDownFeedbackFunc);
|
PowerIsOnFeedback = new BoolFeedback(CommonBoolCue.PowerOnFeedback, PowerIsOnFeedbackFunc);
|
||||||
IsWarmingUpFeedback = new BoolFeedback(CommonBoolCue.IsWarmingUp, IsWarmingUpFeedbackFunc);
|
IsCoolingDownFeedback = new BoolFeedback(CommonBoolCue.IsCoolingDown, IsCoolingDownFeedbackFunc);
|
||||||
|
IsWarmingUpFeedback = new BoolFeedback(CommonBoolCue.IsWarmingUp, IsWarmingUpFeedbackFunc);
|
||||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
|
||||||
}
|
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||||
|
}
|
||||||
public abstract void PowerOn();
|
|
||||||
public abstract void PowerOff();
|
public abstract void PowerOn();
|
||||||
public abstract void PowerToggle();
|
public abstract void PowerOff();
|
||||||
|
public abstract void PowerToggle();
|
||||||
public virtual List<Feedback> Feedbacks
|
|
||||||
{
|
public virtual List<Feedback> Feedbacks
|
||||||
get
|
{
|
||||||
{
|
get
|
||||||
return new List<Feedback>
|
{
|
||||||
{
|
return new List<Feedback>
|
||||||
PowerIsOnFeedback,
|
{
|
||||||
IsCoolingDownFeedback,
|
PowerIsOnFeedback,
|
||||||
IsWarmingUpFeedback
|
IsCoolingDownFeedback,
|
||||||
};
|
IsWarmingUpFeedback
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public abstract void ExecuteSwitch(object selector);
|
|
||||||
|
public abstract void ExecuteSwitch(object selector);
|
||||||
}
|
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
///
|
||||||
public abstract class TwoWayDisplayBase : DisplayBase
|
/// </summary>
|
||||||
{
|
public abstract class TwoWayDisplayBase : DisplayBase
|
||||||
public static MockDisplay DefaultDisplay {
|
{
|
||||||
get
|
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||||
{
|
|
||||||
if (_DefaultDisplay == null)
|
abstract protected Func<string> CurrentInputFeedbackFunc { get; }
|
||||||
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
|
||||||
return _DefaultDisplay;
|
|
||||||
}
|
public static MockDisplay DefaultDisplay
|
||||||
}
|
{
|
||||||
static MockDisplay _DefaultDisplay;
|
get
|
||||||
|
{
|
||||||
public TwoWayDisplayBase(string key, string name)
|
if (_DefaultDisplay == null)
|
||||||
: base(key, name)
|
_DefaultDisplay = new MockDisplay("default", "Default Display");
|
||||||
{
|
return _DefaultDisplay;
|
||||||
WarmupTime = 7000;
|
}
|
||||||
CooldownTime = 15000;
|
}
|
||||||
}
|
static MockDisplay _DefaultDisplay;
|
||||||
|
|
||||||
}
|
public TwoWayDisplayBase(string key, string name)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
|
||||||
|
|
||||||
|
WarmupTime = 7000;
|
||||||
|
CooldownTime = 15000;
|
||||||
|
|
||||||
|
Feedbacks.Add(CurrentInputFeedback);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||||
|
protected override Func<string> CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } }
|
||||||
|
|
||||||
int VolumeHeldRepeatInterval = 200;
|
int VolumeHeldRepeatInterval = 200;
|
||||||
ushort VolumeInterval = 655;
|
ushort VolumeInterval = 655;
|
||||||
|
|||||||
Binary file not shown.
@@ -1,200 +1,201 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for RoutingInput and Output ports
|
/// Base class for RoutingInput and Output ports
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class RoutingPort : IKeyed
|
public abstract class RoutingPort : IKeyed
|
||||||
{
|
{
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
public eRoutingSignalType Type { get; private set; }
|
public eRoutingSignalType Type { get; private set; }
|
||||||
public eRoutingPortConnectionType ConnectionType { get; private set; }
|
public eRoutingPortConnectionType ConnectionType { get; private set; }
|
||||||
public readonly object Selector;
|
public readonly object Selector;
|
||||||
public bool IsInternal { get; private set; }
|
public bool IsInternal { get; private set; }
|
||||||
|
public object FeedbackMatchObject { get; set; }
|
||||||
public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal)
|
|
||||||
{
|
public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal)
|
||||||
Key = key;
|
{
|
||||||
Type = type;
|
Key = key;
|
||||||
ConnectionType = connType;
|
Type = type;
|
||||||
Selector = selector;
|
ConnectionType = connType;
|
||||||
IsInternal = IsInternal;
|
Selector = selector;
|
||||||
}
|
IsInternal = IsInternal;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public enum eRoutingSignalType
|
|
||||||
{
|
public enum eRoutingSignalType
|
||||||
Audio,
|
{
|
||||||
Video,
|
Audio,
|
||||||
AudioVideo
|
Video,
|
||||||
}
|
AudioVideo
|
||||||
|
}
|
||||||
public enum eRoutingPortConnectionType
|
|
||||||
{
|
public enum eRoutingPortConnectionType
|
||||||
None, BackplaneOnly, DisplayPort, Dvi, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi,
|
{
|
||||||
Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker
|
None, BackplaneOnly, DisplayPort, Dvi, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi,
|
||||||
}
|
Composite, Component, DmCat, DmMmFiber, DmSmFiber, Speaker
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Basic RoutingInput with no statuses.
|
/// <summary>
|
||||||
/// </summary>
|
/// Basic RoutingInput with no statuses.
|
||||||
public class RoutingInputPort : RoutingPort
|
/// </summary>
|
||||||
{
|
public class RoutingInputPort : RoutingPort
|
||||||
/// <summary>
|
{
|
||||||
/// The IRoutingInputs object this lives on
|
/// <summary>
|
||||||
/// </summary>
|
/// The IRoutingInputs object this lives on
|
||||||
public IRoutingInputs ParentDevice { get; private set; }
|
/// </summary>
|
||||||
|
public IRoutingInputs ParentDevice { get; private set; }
|
||||||
/// <summary>
|
|
||||||
/// Constructor for a basic RoutingInputPort
|
/// <summary>
|
||||||
/// </summary>
|
/// Constructor for a basic RoutingInputPort
|
||||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
/// </summary>
|
||||||
/// May be string, number, whatever</param>
|
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
/// May be string, number, whatever</param>
|
||||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||||
object selector, IRoutingInputs parent)
|
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||||
: this (key, type, connType, selector, parent, false)
|
object selector, IRoutingInputs parent)
|
||||||
{
|
: this (key, type, connType, selector, parent, false)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Constructor for a virtual routing input port that lives inside a device. For example
|
/// <summary>
|
||||||
/// the ports that link a DM card to a DM matrix bus
|
/// Constructor for a virtual routing input port that lives inside a device. For example
|
||||||
/// </summary>
|
/// the ports that link a DM card to a DM matrix bus
|
||||||
/// <param name="isInternal">true for internal ports</param>
|
/// </summary>
|
||||||
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
/// <param name="isInternal">true for internal ports</param>
|
||||||
object selector, IRoutingInputs parent, bool isInternal)
|
public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||||
: base(key, type, connType, selector, isInternal)
|
object selector, IRoutingInputs parent, bool isInternal)
|
||||||
{
|
: base(key, type, connType, selector, isInternal)
|
||||||
if (parent == null)
|
{
|
||||||
throw new ArgumentNullException("parent");
|
if (parent == null)
|
||||||
ParentDevice = parent;
|
throw new ArgumentNullException("parent");
|
||||||
}
|
ParentDevice = parent;
|
||||||
|
}
|
||||||
|
|
||||||
///// <summary>
|
|
||||||
///// Static method to get a named port from a named device
|
///// <summary>
|
||||||
///// </summary>
|
///// Static method to get a named port from a named device
|
||||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
///// </summary>
|
||||||
//public static RoutingInputPort GetDevicePort(string deviceKey, string portKey)
|
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||||
//{
|
//public static RoutingInputPort GetDevicePort(string deviceKey, string portKey)
|
||||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingInputs;
|
//{
|
||||||
// if (sourceDev == null)
|
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingInputs;
|
||||||
// return null;
|
// if (sourceDev == null)
|
||||||
// return sourceDev.InputPorts[portKey];
|
// return null;
|
||||||
//}
|
// return sourceDev.InputPorts[portKey];
|
||||||
|
//}
|
||||||
///// <summary>
|
|
||||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
///// <summary>
|
||||||
///// Uses ICardPortsDevice.GetChildInputPort
|
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||||
///// </summary>
|
///// Uses ICardPortsDevice.GetChildInputPort
|
||||||
///// <param name="cardKey">'input-N'</param>
|
///// </summary>
|
||||||
///// <returns>null if device, card or port doesn't exist</returns>
|
///// <param name="cardKey">'input-N'</param>
|
||||||
//public static RoutingInputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
///// <returns>null if device, card or port doesn't exist</returns>
|
||||||
//{
|
//public static RoutingInputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
//{
|
||||||
// if (sourceDev == null)
|
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||||
// return null;
|
// if (sourceDev == null)
|
||||||
// return sourceDev.GetChildInputPort(cardKey, portKey);
|
// return null;
|
||||||
//}
|
// return sourceDev.GetChildInputPort(cardKey, portKey);
|
||||||
}
|
//}
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// A RoutingInputPort for devices like DM-TX and DM input cards.
|
/// <summary>
|
||||||
/// Will provide video statistics on connected signals
|
/// A RoutingInputPort for devices like DM-TX and DM input cards.
|
||||||
/// </summary>
|
/// Will provide video statistics on connected signals
|
||||||
public class RoutingInputPortWithVideoStatuses : RoutingInputPort
|
/// </summary>
|
||||||
{
|
public class RoutingInputPortWithVideoStatuses : RoutingInputPort
|
||||||
/// <summary>
|
{
|
||||||
/// Video statuses attached to this port
|
/// <summary>
|
||||||
/// </summary>
|
/// Video statuses attached to this port
|
||||||
public VideoStatusOutputs VideoStatus { get; private set; }
|
/// </summary>
|
||||||
|
public VideoStatusOutputs VideoStatus { get; private set; }
|
||||||
/// <summary>
|
|
||||||
/// Constructor
|
/// <summary>
|
||||||
/// </summary>
|
/// Constructor
|
||||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
/// </summary>
|
||||||
/// May be string, number, whatever</param>
|
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||||
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
/// May be string, number, whatever</param>
|
||||||
/// <param name="funcs">A VideoStatusFuncsWrapper used to assign the callback funcs that will get
|
/// <param name="parent">The IRoutingInputs object this lives on</param>
|
||||||
/// the values for the various stats</param>
|
/// <param name="funcs">A VideoStatusFuncsWrapper used to assign the callback funcs that will get
|
||||||
public RoutingInputPortWithVideoStatuses(string key,
|
/// the values for the various stats</param>
|
||||||
eRoutingSignalType type, eRoutingPortConnectionType connType, object selector,
|
public RoutingInputPortWithVideoStatuses(string key,
|
||||||
IRoutingInputs parent, VideoStatusFuncsWrapper funcs) :
|
eRoutingSignalType type, eRoutingPortConnectionType connType, object selector,
|
||||||
base(key, type, connType, selector, parent)
|
IRoutingInputs parent, VideoStatusFuncsWrapper funcs) :
|
||||||
{
|
base(key, type, connType, selector, parent)
|
||||||
VideoStatus = new VideoStatusOutputs(funcs);
|
{
|
||||||
}
|
VideoStatus = new VideoStatusOutputs(funcs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public class RoutingOutputPort : RoutingPort
|
|
||||||
{
|
public class RoutingOutputPort : RoutingPort
|
||||||
/// <summary>
|
{
|
||||||
/// The IRoutingOutputs object this port lives on
|
/// <summary>
|
||||||
/// </summary>
|
/// The IRoutingOutputs object this port lives on
|
||||||
public IRoutingOutputs ParentDevice { get; private set; }
|
/// </summary>
|
||||||
|
public IRoutingOutputs ParentDevice { get; private set; }
|
||||||
public InUseTracking InUseTracker { get; private set; }
|
|
||||||
|
public InUseTracking InUseTracker { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
/// </summary>
|
||||||
/// May be string, number, whatever</param>
|
/// <param name="selector">An object used to refer to this port in the IRouting device's ExecuteSwitch method.
|
||||||
/// <param name="parent">The IRoutingOutputs object this port lives on</param>
|
/// May be string, number, whatever</param>
|
||||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
/// <param name="parent">The IRoutingOutputs object this port lives on</param>
|
||||||
object selector, IRoutingOutputs parent)
|
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||||
: this(key, type, connType, selector, parent, false)
|
object selector, IRoutingOutputs parent)
|
||||||
{
|
: this(key, type, connType, selector, parent, false)
|
||||||
}
|
{
|
||||||
|
}
|
||||||
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
|
||||||
object selector, IRoutingOutputs parent, bool isInternal)
|
public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType,
|
||||||
: base(key, type, connType, selector, isInternal)
|
object selector, IRoutingOutputs parent, bool isInternal)
|
||||||
{
|
: base(key, type, connType, selector, isInternal)
|
||||||
if (parent == null)
|
{
|
||||||
throw new ArgumentNullException("parent");
|
if (parent == null)
|
||||||
ParentDevice = parent;
|
throw new ArgumentNullException("parent");
|
||||||
InUseTracker = new InUseTracking();
|
ParentDevice = parent;
|
||||||
}
|
InUseTracker = new InUseTracking();
|
||||||
|
}
|
||||||
public override string ToString()
|
|
||||||
{
|
public override string ToString()
|
||||||
return ParentDevice.Key + ":" + Key;
|
{
|
||||||
}
|
return ParentDevice.Key + ":" + Key;
|
||||||
|
}
|
||||||
///// <summary>
|
|
||||||
///// Static method to get a named port from a named device
|
///// <summary>
|
||||||
///// </summary>
|
///// Static method to get a named port from a named device
|
||||||
///// <returns>Returns null if device or port doesn't exist</returns>
|
///// </summary>
|
||||||
//public static RoutingOutputPort GetDevicePort(string deviceKey, string portKey)
|
///// <returns>Returns null if device or port doesn't exist</returns>
|
||||||
//{
|
//public static RoutingOutputPort GetDevicePort(string deviceKey, string portKey)
|
||||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingOutputs;
|
//{
|
||||||
// if (sourceDev == null)
|
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as IRoutingOutputs;
|
||||||
// return null;
|
// if (sourceDev == null)
|
||||||
// var port = sourceDev.OutputPorts[portKey];
|
// return null;
|
||||||
// if (port == null)
|
// var port = sourceDev.OutputPorts[portKey];
|
||||||
// Debug.Console(0, "WARNING: Device '{0}' does does not contain output port '{1}'", deviceKey, portKey);
|
// if (port == null)
|
||||||
// return port;
|
// Debug.Console(0, "WARNING: Device '{0}' does does not contain output port '{1}'", deviceKey, portKey);
|
||||||
//}
|
// return port;
|
||||||
|
//}
|
||||||
///// <summary>
|
|
||||||
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
///// <summary>
|
||||||
///// Uses ICardPortsDevice.GetChildOutputPort on that device
|
///// Static method to get a named port from a card in a named ICardPortsDevice device
|
||||||
///// </summary>
|
///// Uses ICardPortsDevice.GetChildOutputPort on that device
|
||||||
///// <param name="cardKey">'input-N' or 'output-N'</param>
|
///// </summary>
|
||||||
///// <returns>null if device, card or port doesn't exist</returns>
|
///// <param name="cardKey">'input-N' or 'output-N'</param>
|
||||||
//public static RoutingOutputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
///// <returns>null if device, card or port doesn't exist</returns>
|
||||||
//{
|
//public static RoutingOutputPort GetDeviceCardPort(string deviceKey, string cardKey, string portKey)
|
||||||
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
//{
|
||||||
// if (sourceDev == null)
|
// var sourceDev = DeviceManager.GetDeviceForKey(deviceKey) as ICardPortsDevice;
|
||||||
// return null;
|
// if (sourceDev == null)
|
||||||
// var port = sourceDev.GetChildOutputPort(cardKey, portKey);
|
// return null;
|
||||||
//}
|
// var port = sourceDev.GetChildOutputPort(cardKey, portKey);
|
||||||
}
|
//}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,8 +29,9 @@ namespace PepperDash.Essentials.Core.Routing
|
|||||||
public const string DisplayPortOut = "displayPortOut";
|
public const string DisplayPortOut = "displayPortOut";
|
||||||
public const string DmIn = "dmIn";
|
public const string DmIn = "dmIn";
|
||||||
public const string DmOut = "dmOut";
|
public const string DmOut = "dmOut";
|
||||||
public const string DviIn = "dviIn";
|
public const string DviIn = "dviIn";
|
||||||
public const string DviOut = "dviOut";
|
public const string DviIn1 = "dviIn1";
|
||||||
|
public const string DviOut = "dviOut";
|
||||||
public const string HdmiIn = "hdmiIn";
|
public const string HdmiIn = "hdmiIn";
|
||||||
public const string HdmiIn1 = "hdmiIn1";
|
public const string HdmiIn1 = "hdmiIn1";
|
||||||
public const string HdmiIn2 = "hdmiIn2";
|
public const string HdmiIn2 = "hdmiIn2";
|
||||||
@@ -39,7 +40,9 @@ namespace PepperDash.Essentials.Core.Routing
|
|||||||
public const string HdmiIn5 = "hdmiIn5";
|
public const string HdmiIn5 = "hdmiIn5";
|
||||||
public const string HdmiIn6 = "hdmiIn6";
|
public const string HdmiIn6 = "hdmiIn6";
|
||||||
public const string HdmiOut = "hdmiOut";
|
public const string HdmiOut = "hdmiOut";
|
||||||
public const string RgbIn = "rgbIn";
|
public const string RgbIn = "rgbIn";
|
||||||
|
public const string RgbIn1 = "rgbIn1";
|
||||||
|
public const string RgbIn2 = "rgbIn2";
|
||||||
public const string VgaIn = "vgaIn";
|
public const string VgaIn = "vgaIn";
|
||||||
public const string VgaOut = "vgaOut";
|
public const string VgaOut = "vgaOut";
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -42,7 +42,7 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
{
|
{
|
||||||
var comm = CommFactory.CreateCommForDevice(dc);
|
var comm = CommFactory.CreateCommForDevice(dc);
|
||||||
if (comm != null)
|
if (comm != null)
|
||||||
return new SamsungMDC(dc.Key, dc.Name, comm, Convert.ToByte(dc.Properties["byte"]));
|
return new SamsungMDC(dc.Key, dc.Name, comm, dc.Properties["id"].Value<string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||||
|
protected override Func<string> CurrentInputFeedbackFunc { get { return () => "Not Implemented"; } }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for IBasicCommunication
|
/// Constructor for IBasicCommunication
|
||||||
|
|||||||
@@ -19,144 +19,50 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
public CommunicationGather PortGather { get; private set; }
|
public CommunicationGather PortGather { get; private set; }
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
|
|
||||||
|
private StringBuilder Buffer = new StringBuilder();
|
||||||
|
|
||||||
#region Command constants
|
#region Command constants
|
||||||
|
|
||||||
public string Ack
|
public string Ack { get; private set; }
|
||||||
{
|
public string Nak { get; private set; }
|
||||||
get { return AssembleCommand(string.Format("\xAA\xFF{0}\x03A", ID)); }
|
|
||||||
}
|
|
||||||
public string Nak
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\xAA\xFF{0}\x03N", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Power Commands
|
// Power Commands
|
||||||
|
|
||||||
public string PowerGetCmd
|
public string PowerGetCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x11{0}\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string PowerOnCmd
|
public string PowerOnCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x11{0}\x01\x01", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string PowerOffCmd
|
public string PowerOffCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x11{0}\x01\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Input Commands
|
// Input Commands
|
||||||
|
|
||||||
public string InputGetCmd
|
public string InputGetCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Dp1Cmd
|
public string Dp1Cmd { get; private set; }
|
||||||
{
|
public string Hdmi1Cmd { get; private set; }
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x25", ID)); }
|
public string Hdmi2Cmd { get; private set; }
|
||||||
}
|
public string Hdmi3Cmd { get; private set; }
|
||||||
|
public string Dvi1Cmd { get; private set; }
|
||||||
public string Hdmi1Cmd
|
public string Video1Cmd { get; private set; }
|
||||||
{
|
public string Rgb1Cmd { get; private set; }
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x21", ID)); }
|
public string Rgb2Cmd { get; private set; }
|
||||||
}
|
|
||||||
|
|
||||||
public string Hdmi2Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x23", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Hdmi3Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x32", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Dvi1Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x18", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Rgb1Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x14", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Rgb2Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x1E", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Video1Cmd
|
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x14{0}\x01\x08", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Volume Commands
|
// Volume Commands
|
||||||
|
|
||||||
public string MuteGetCmd
|
public string MuteGetCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x13{0}\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string MuteOnCmd
|
public string MuteOnCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x13{0}\x01\x01", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string MuteOffCmd
|
public string MuteOffCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x13{0}\x01\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string VolumeGetCmd
|
public string VolumeGetCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return AssembleCommand(string.Format("\x12{0}\x00", ID)); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To be appended with the requested volume level. Does not include checksum calculation
|
/// To be appended with the requested volume level. Does not include checksum calculation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string VolumeLevelPartialCmd
|
public string VolumeLevelPartialCmd { get; private set; }
|
||||||
{
|
|
||||||
get { return string.Format("\x12{0}\x01", ID); }
|
|
||||||
}
|
|
||||||
|
|
||||||
//public string InputGetCmd = "";
|
|
||||||
//public const string Hdmi1Cmd = "";
|
|
||||||
//public const string Hdmi2Cmd = "";
|
|
||||||
//public const string Hdmi3Cmd = "";
|
|
||||||
//public const string Hdmi4Cmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x38\x33\x03\x79\x0D";
|
|
||||||
//public const string Dp1Cmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x30\x46\x03\x04\x0D";
|
|
||||||
//public const string Dp2Cmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x31\x30\x03\x73\x0D";
|
|
||||||
//public const string Dvi1Cmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x30\x33\x03\x71\x0d";
|
|
||||||
//public const string Video1Cmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x30\x35\x03\x77\x0D";
|
|
||||||
//public const string VgaCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x30\x31\x03\x73\x0D";
|
|
||||||
//public const string RgbCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x30\x30\x30\x30\x32\x03\x70\x0D";
|
|
||||||
|
|
||||||
//public const string PowerOnCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x31\x03\x73\x0D";
|
|
||||||
//public const string PowerOffCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x34\x03\x76\x0D";
|
|
||||||
//public const string PowerToggleIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x30\x33\x30\x33\x03\x02\x0D";
|
|
||||||
|
|
||||||
//public const string MuteOffCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x38\x44\x30\x30\x30\x30\x03\x08\x0D";
|
|
||||||
//public const string MuteOnCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x38\x44\x30\x30\x30\x31\x03\x09\x0D";
|
|
||||||
//public const string MuteToggleIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x31\x42\x30\x33\x03\x72\x0D";
|
|
||||||
//public const string MuteGetCmd = "\x01\x30\x41\x30\x43\x30\x36\x02\x30\x30\x38\x44\x03\x79\x0D";
|
|
||||||
|
|
||||||
//public const string VolumeGetCmd = "\x01\x30\x41\x30\x43\x30\x36\x02\x30\x30\x36\x32\x03\x01\x0D";
|
|
||||||
//public const string VolumeLevelPartialCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x30\x30\x36\x32"; //\x46\x46\x46\x46\x03\xNN\x0D
|
|
||||||
//public const string VolumeUpCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x31\x30\x41\x44\x30\x30\x30\x31\x03\x71\x0D";
|
|
||||||
//public const string VolumeDownCmd = "\x01\x30\x41\x30\x45\x30\x41\x02\x31\x30\x41\x44\x30\x30\x30\x32\x03\x72\x0D";
|
|
||||||
|
|
||||||
//public const string MenuIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x32\x30\x30\x33\x03\x03\x0D";
|
|
||||||
//public const string UpIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x31\x35\x30\x33\x03\x05\x0D";
|
|
||||||
//public const string DownIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x31\x34\x30\x33\x03\x04\x0D";
|
|
||||||
//public const string LeftIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x32\x31\x30\x33\x03\x02\x0D";
|
|
||||||
//public const string RightIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x32\x32\x30\x33\x03\x01\x0D";
|
|
||||||
//public const string SelectIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x32\x33\x30\x33\x03\x00\x0D";
|
|
||||||
//public const string ExitIrCmd = "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x31\x30\x30\x30\x31\x46\x30\x33\x03\x76\x0D";
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
@@ -167,17 +73,22 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="command"></param>
|
/// <param name="command"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string AssembleCommand(string command)
|
private string AppendChecksum(string command)
|
||||||
{
|
{
|
||||||
int checksum = 0;
|
int checksum = 0;
|
||||||
|
|
||||||
var bytes = command.ToCharArray();
|
//var bytes = command.ToCharArray();
|
||||||
|
|
||||||
for (int i = 1; i < bytes.Length; i++)
|
byte[] bytes = Encoding.ASCII.GetBytes(command);
|
||||||
|
|
||||||
|
for (int i = 1; i < bytes.Length; i++) /*Convert.ToByte(bytes[i]*/
|
||||||
{
|
{
|
||||||
checksum = checksum + Convert.ToByte(bytes[i]);
|
checksum = checksum + bytes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checksum >= 0x100) // Check if value is greater than 0x100 and if so, remove the first digit by subtracting 0x100
|
||||||
|
checksum = checksum - 0x100;
|
||||||
|
|
||||||
var checksumByte = Convert.ToByte(checksum);
|
var checksumByte = Convert.ToByte(checksum);
|
||||||
|
|
||||||
string result = string.Format("{0}{1}", command, (char)checksumByte);
|
string result = string.Format("{0}{1}", command, (char)checksumByte);
|
||||||
@@ -191,82 +102,144 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
bool _IsCoolingDown;
|
bool _IsCoolingDown;
|
||||||
ushort _VolumeLevel;
|
ushort _VolumeLevel;
|
||||||
bool _IsMuted;
|
bool _IsMuted;
|
||||||
object _CurrentInputPort;
|
RoutingInputPort _CurrentInputPort;
|
||||||
#warning Add Input FeedbackFunc object
|
|
||||||
|
|
||||||
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
protected override Func<bool> PowerIsOnFeedbackFunc { get { return () => _PowerIsOn; } }
|
||||||
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
protected override Func<bool> IsCoolingDownFeedbackFunc { get { return () => _IsCoolingDown; } }
|
||||||
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
protected override Func<bool> IsWarmingUpFeedbackFunc { get { return () => _IsWarmingUp; } }
|
||||||
|
protected override Func<string> CurrentInputFeedbackFunc { get { return () => _CurrentInputPort.Key; } }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for IBasicCommunication
|
/// Constructor for IBasicCommunication
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SamsungMDC(string key, string name, IBasicCommunication comm, byte id)
|
public SamsungMDC(string key, string name, IBasicCommunication comm, string id)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Communication = comm;
|
Communication = comm;
|
||||||
ID = id;
|
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
Init();
|
ID = id == null ? (byte)0x01 : Convert.ToByte(id); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for TCP
|
/// Constructor for TCP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SamsungMDC(string key, string name, string hostname, int port, byte id)
|
public SamsungMDC(string key, string name, string hostname, int port, string id)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Communication = new GenericTcpIpClient(key + "-tcp", hostname, port, 5000);
|
Communication = new GenericTcpIpClient(key + "-tcp", hostname, port, 5000);
|
||||||
ID = id;
|
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
Init();
|
ID = id == null ? (byte)0x01 : Convert.ToByte(id); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor for COM
|
/// Constructor for COM
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SamsungMDC(string key, string name, ComPort port, ComPort.ComPortSpec spec, byte id)
|
public SamsungMDC(string key, string name, ComPort port, ComPort.ComPortSpec spec, string id)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
Communication = new ComPortController(key + "-com", port, spec);
|
Communication = new ComPortController(key + "-com", port, spec);
|
||||||
ID = id;
|
Communication.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(Communication_TextReceived);
|
||||||
Init();
|
ID = id == null ? (byte)0x01 : Convert.ToByte(id); // If id is null, set default value of 0x01, otherwise assign value passed in constructor
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddRoutingInputPort(RoutingInputPort port, string cmdPrefix, byte fbMatch)
|
||||||
|
{
|
||||||
|
port.FeedbackMatchObject = fbMatch;
|
||||||
|
InputPorts.Add(port);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
PortGather = new CommunicationGather(Communication, '\x0d');
|
|
||||||
PortGather.LineReceived += this.Port_LineReceived;
|
|
||||||
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, "xx\x0d");
|
|
||||||
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
CommunicationMonitor = new GenericCommunicationMonitor(this, Communication, 30000, 120000, 300000, AppendChecksum(string.Format("\x11{0}\x01\x01", ID)));
|
||||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.DisplayPortIn1, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.AudioVideo,
|
|
||||||
eRoutingPortConnectionType.Composite, new Action(InputVideo1), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video,
|
|
||||||
eRoutingPortConnectionType.Vga, new Action(InputRgb1), this));
|
|
||||||
InputPorts.Add(new RoutingInputPort(RoutingPortNames.RgbIn, eRoutingSignalType.Video,
|
|
||||||
eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this));
|
|
||||||
|
|
||||||
#warning Add missing input ports
|
// Build Command Strings
|
||||||
|
|
||||||
|
Ack = AppendChecksum(string.Format("\xAA\xFF{0}\x03A", ID));
|
||||||
|
|
||||||
|
Nak = AppendChecksum(string.Format("\xAA\xFF{0}\x03N", ID));
|
||||||
|
|
||||||
|
//Power Commands
|
||||||
|
|
||||||
|
PowerGetCmd = AppendChecksum(string.Format("\x11{0}\x00", ID));
|
||||||
|
|
||||||
|
PowerOnCmd = AppendChecksum(string.Format("\x11{0}\x01\x01", ID));
|
||||||
|
|
||||||
|
PowerOffCmd = AppendChecksum(string.Format("\x11{0}\x01\x00", ID));
|
||||||
|
|
||||||
|
//Input Commands
|
||||||
|
|
||||||
|
InputGetCmd = AppendChecksum(string.Format("\x14{0}\x00", ID));
|
||||||
|
|
||||||
|
string cmdPrefix = string.Format("\x14{0}\x01", ID);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), cmdPrefix, 0x21);
|
||||||
|
Hdmi1Cmd = string.Format("{0}{1}", cmdPrefix, 0x21);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this), cmdPrefix, 0x23);
|
||||||
|
Hdmi2Cmd = string.Format("{0}{1}", cmdPrefix, 0x23);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this), cmdPrefix, 0x32);
|
||||||
|
Hdmi3Cmd = string.Format("{0}{1}", cmdPrefix, 0x32);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DisplayPortIn1, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this), cmdPrefix, 0x25);
|
||||||
|
Dp1Cmd = string.Format("{0}{1}", cmdPrefix, 0x25);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DviIn, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.Dvi, new Action(InputDvi1), this), cmdPrefix, 0x18);
|
||||||
|
Dvi1Cmd = string.Format("{0}{1}", cmdPrefix, 0x18);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.Composite, new Action(InputVideo1), this), cmdPrefix, 0x08);
|
||||||
|
Video1Cmd = string.Format("{0}{1}", cmdPrefix, 0x08);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn1, eRoutingSignalType.Video,
|
||||||
|
eRoutingPortConnectionType.Vga, new Action(InputRgb1), this), cmdPrefix, 0x14);
|
||||||
|
Rgb1Cmd = string.Format("{0}{1}", cmdPrefix, 0x14);
|
||||||
|
|
||||||
|
AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.RgbIn2, eRoutingSignalType.Video,
|
||||||
|
eRoutingPortConnectionType.Rgb, new Action(new Action(InputRgb2)), this), cmdPrefix, 0x1E);
|
||||||
|
Rgb2Cmd = string.Format("{0}{1}", cmdPrefix, 0x1E);
|
||||||
|
|
||||||
|
// Mute Commands
|
||||||
|
|
||||||
|
MuteGetCmd = AppendChecksum(string.Format("\x13{0}\x00", ID));
|
||||||
|
|
||||||
|
MuteOnCmd = AppendChecksum(string.Format("\x13{0}\x01\x01", ID));
|
||||||
|
|
||||||
|
MuteOffCmd = AppendChecksum(string.Format("\x13{0}\x01\x00", ID));
|
||||||
|
|
||||||
|
// Volume Commands
|
||||||
|
|
||||||
|
VolumeGetCmd = AppendChecksum(string.Format("\x12{0}\x00", ID));
|
||||||
|
|
||||||
|
VolumeLevelPartialCmd = string.Format("\x12{0}\x01", ID);
|
||||||
|
|
||||||
VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevel; });
|
VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevel; });
|
||||||
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
MuteFeedback = new BoolFeedback(() => _IsMuted);
|
||||||
|
|
||||||
// new BoolCueActionPair(CommonBoolCue.Menu, b => { if(b) Send(MenuIrCmd); }),
|
// Query initial device status
|
||||||
// new BoolCueActionPair(CommonBoolCue.Up, b => { if(b) Send(UpIrCmd); }),
|
|
||||||
// new BoolCueActionPair(CommonBoolCue.Down, b => { if(b) Send(DownIrCmd); }),
|
Send(PowerGetCmd);
|
||||||
// new BoolCueActionPair(CommonBoolCue.Left, b => { if(b) Send(LeftIrCmd); }),
|
|
||||||
// new BoolCueActionPair(CommonBoolCue.Right, b => { if(b) Send(RightIrCmd); }),
|
Send(InputGetCmd);
|
||||||
// new BoolCueActionPair(CommonBoolCue.Select, b => { if(b) Send(SelectIrCmd); }),
|
|
||||||
// new BoolCueActionPair(CommonBoolCue.Exit, b => { if(b) Send(ExitIrCmd); }),
|
Send(VolumeGetCmd);
|
||||||
//};
|
|
||||||
|
Send(MuteGetCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SamsungMDC()
|
~SamsungMDC()
|
||||||
@@ -295,109 +268,128 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args)
|
void Communication_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
|
||||||
{
|
{
|
||||||
if (Debug.Level == 2)
|
Buffer.Append(e.Text);
|
||||||
Debug.Console(2, this, "Received: '{0}'", ComTextHelper.GetEscapedText(args.Text));
|
|
||||||
|
|
||||||
if (args.Text.IndexOf(Ack) > -1)
|
if (Debug.Level == 2)
|
||||||
{
|
Debug.Console(2, this, "Received: '{0}'", ComTextHelper.GetEscapedText(e.Text));
|
||||||
var bytes = args.Text.ToCharArray();
|
|
||||||
|
|
||||||
var commandByte = bytes[5];
|
ParseData();
|
||||||
|
}
|
||||||
|
|
||||||
var dataByte = bytes[6];
|
void ParseData()
|
||||||
|
{
|
||||||
|
if(Buffer.Length < 8) // Message length must be > 8 bytes
|
||||||
|
return;
|
||||||
|
|
||||||
switch (commandByte)
|
var sample = Buffer.ToString();
|
||||||
{
|
|
||||||
case '\x11': // Power State
|
|
||||||
{
|
|
||||||
if (dataByte == '\x00')
|
|
||||||
{
|
|
||||||
if (_PowerIsOn)
|
|
||||||
{
|
|
||||||
_IsWarmingUp = false;
|
|
||||||
_IsCoolingDown = true;
|
|
||||||
IsCoolingDownFeedback.FireUpdate();
|
|
||||||
IsWarmingUpFeedback.FireUpdate();
|
|
||||||
_PowerIsOn = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (dataByte == '\x01')
|
|
||||||
{
|
|
||||||
if (!_PowerIsOn)
|
|
||||||
{
|
|
||||||
_IsCoolingDown = false;
|
|
||||||
_IsWarmingUp = true;
|
|
||||||
IsCoolingDownFeedback.FireUpdate();
|
|
||||||
IsWarmingUpFeedback.FireUpdate();
|
|
||||||
_PowerIsOn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PowerIsOnFeedback.FireUpdate();
|
var messageStart = sample.IndexOf("\xAA\xFF");
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '\x12': // Volume Level
|
|
||||||
{
|
|
||||||
_VolumeLevel = (ushort)Scale(dataByte, 0, 100, 0, 65535);
|
|
||||||
|
|
||||||
VolumeLevelFeedback.FireUpdate();
|
if (messageStart > -1)
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '\x13': // Mute State
|
|
||||||
{
|
|
||||||
if (dataByte == '\x00')
|
|
||||||
{
|
|
||||||
_IsMuted = false;
|
|
||||||
}
|
|
||||||
else if (dataByte == '\x01')
|
|
||||||
{
|
|
||||||
_IsMuted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MuteFeedback.FireUpdate();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '\x14': // Input State
|
|
||||||
{
|
|
||||||
switch (dataByte)
|
|
||||||
{
|
|
||||||
case '\x25': // DisplayPort
|
|
||||||
{
|
|
||||||
#warning Handle input port types
|
|
||||||
|
|
||||||
//_CurrentInputPort =
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '\x15': // Aspect Ratio
|
|
||||||
{
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
Debug.Console(2, this, "Unreckocnized Response Command Type: {0}", commandByte);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (args.Text.IndexOf(Nak) > -1)
|
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Nak received");
|
StringBuilder garbage;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(messageStart > 0) // Check for leftover bytes before first full message and remove
|
||||||
|
garbage = Buffer.Remove(0, messageStart - 1);
|
||||||
|
|
||||||
|
var chunk = Buffer.Remove(messageStart, 8); // Remove first message
|
||||||
|
|
||||||
|
var message = chunk.ToString();
|
||||||
|
|
||||||
|
if (message.IndexOf(Ack) > -1) // Check to see if Ack message
|
||||||
|
{
|
||||||
|
var bytes = message.ToCharArray();
|
||||||
|
|
||||||
|
var commandByte = bytes[5];
|
||||||
|
|
||||||
|
var dataByte = bytes[6];
|
||||||
|
|
||||||
|
switch (commandByte)
|
||||||
|
{
|
||||||
|
case '\x11': // Power State
|
||||||
|
{
|
||||||
|
var currentState = _PowerIsOn;
|
||||||
|
|
||||||
|
if (dataByte == '\x00')
|
||||||
|
_PowerIsOn = false;
|
||||||
|
|
||||||
|
else if (dataByte == '\x01')
|
||||||
|
_PowerIsOn = true;
|
||||||
|
|
||||||
|
if(currentState != _PowerIsOn)
|
||||||
|
PowerIsOnFeedback.FireUpdate();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '\x12': // Volume Level
|
||||||
|
{
|
||||||
|
_VolumeLevel = (ushort)Scale(dataByte, 0, 100, 0, 65535);
|
||||||
|
|
||||||
|
VolumeLevelFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '\x13': // Mute State
|
||||||
|
{
|
||||||
|
if (dataByte == '\x00')
|
||||||
|
{
|
||||||
|
_IsMuted = false;
|
||||||
|
}
|
||||||
|
else if (dataByte == '\x01')
|
||||||
|
{
|
||||||
|
_IsMuted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MuteFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '\x14': // Input State
|
||||||
|
{
|
||||||
|
var currentInput = InputPorts.FirstOrDefault(i => i.FeedbackMatchObject.Equals(dataByte));
|
||||||
|
|
||||||
|
if (currentInput != null)
|
||||||
|
{
|
||||||
|
_CurrentInputPort = currentInput;
|
||||||
|
|
||||||
|
CurrentInputFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case '\x15': // Aspect Ratio
|
||||||
|
{
|
||||||
|
// Not implemented yet
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Unreckocnized Response Command Type: {0}", commandByte);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (message.IndexOf(Nak) > -1)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Nak received");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Append checksup and send command to device
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s"></param>
|
||||||
void Send(string s)
|
void Send(string s)
|
||||||
{
|
{
|
||||||
|
var cmd = AppendChecksum(s);
|
||||||
|
|
||||||
if (Debug.Level == 2)
|
if (Debug.Level == 2)
|
||||||
Debug.Console(2, this, "Send: '{0}'", ComTextHelper.GetEscapedText(s));
|
Debug.Console(2, this, "Send: '{0}'", ComTextHelper.GetEscapedText(cmd));
|
||||||
Communication.SendText(s);
|
Communication.SendText(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -506,9 +498,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
var scaledLevel = Scale(level, 0, 65535, 0, 100);
|
var scaledLevel = Scale(level, 0, 65535, 0, 100);
|
||||||
|
|
||||||
var levelString = string.Format("{0}{1}", VolumeLevelPartialCmd, Convert.ToByte(scaledLevel));
|
var levelString = string.Format("{0}{1}", VolumeLevelPartialCmd, Convert.ToByte(scaledLevel));
|
||||||
var command = AssembleCommand(levelString);
|
Debug.Console(2, this, "Volume:{0}", ComTextHelper.GetEscapedText(levelString));
|
||||||
Debug.Console(2, this, "Volume:{0}", ComTextHelper.GetEscapedText(command));
|
Send(levelString);
|
||||||
Send(command);
|
|
||||||
_VolumeLevel = level;
|
_VolumeLevel = level;
|
||||||
VolumeLevelFeedback.FireUpdate();
|
VolumeLevelFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -29,8 +29,8 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void InitializeSystem()
|
public override void InitializeSystem()
|
||||||
{
|
{
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
|
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
|
||||||
// ConsoleAccessLevelEnum.AccessOperator);
|
// ConsoleAccessLevelEnum.AccessOperator);
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(s =>
|
||||||
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials
|
|||||||
},
|
},
|
||||||
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
GoWithLoad();
|
//GoWithLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user