diff --git a/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs b/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs index ada97eef..992263bf 100644 --- a/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs +++ b/Essentials Devices Common/Essentials Devices Common/Display/AvocorVTFDisplay.cs @@ -24,6 +24,44 @@ namespace PepperDash.Essentials.Devices.Displays public byte ID { get; private set; } + /// + /// 0x08 + /// + const byte InputVga1Value = 0x00; + /// + /// 0x09 + /// + const byte InputHdmi1Value = 0x09; + /// + /// 0x0a + /// + const byte InputHdmi2Value = 0x0a; + /// + /// 0x0b + /// + const byte InputHdmi3Value = 0x0b; + /// + /// 0x0c + /// + const byte InputHdmi4Value = 0x0c; + /// + /// 0c0d + /// + const byte InputDisplayPort1Value = 0x0d; + /// + /// 0x0e + /// + const byte InputIpcOpsValue = 0x0e; + /// + /// 0x11 + /// + const byte InputHdmi5Value = 0x11; + /// + /// 0x12 + /// + const byte InputMediaPlayerValue = 0x12; + + bool _PowerIsOn; bool _IsWarmingUp; bool _IsCoolingDown; @@ -109,36 +147,34 @@ namespace PepperDash.Essentials.Devices.Displays () => _LastVolumeSent); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), 0x09); + eRoutingPortConnectionType.Hdmi, new Action(InputHdmi1), this), InputHdmi1Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this), 0x10); + eRoutingPortConnectionType.Hdmi, new Action(InputHdmi2), this), InputHdmi2Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this), 0x11); + eRoutingPortConnectionType.Hdmi, new Action(InputHdmi3), this), InputHdmi3Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, new Action(InputHdmi4), this), 0x12); + eRoutingPortConnectionType.Hdmi, new Action(InputHdmi4), this), InputHdmi4Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.HdmiIn5, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, new Action(InputHdmi5), this), 0x17); + eRoutingPortConnectionType.Hdmi, new Action(InputHdmi5), this), InputHdmi5Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.DisplayPortIn1, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this), 0x13); + eRoutingPortConnectionType.DisplayPort, new Action(InputDisplayPort1), this), InputDisplayPort1Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Dvi, new Action(InputVga1), this), 0x00); + eRoutingPortConnectionType.Dvi, new Action(InputVga1), this), InputVga1Value); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.IpcOps, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Composite, new Action(InputIpcOps), this), 0x14); + eRoutingPortConnectionType.Composite, new Action(InputIpcOps), this), InputIpcOpsValue); AddRoutingInputPort(new RoutingInputPort(RoutingPortNames.MediaPlayer, eRoutingSignalType.Video, - eRoutingPortConnectionType.Vga, new Action(InputMediaPlayer), this), 0x18); + eRoutingPortConnectionType.Vga, new Action(InputMediaPlayer), this), InputMediaPlayerValue); VolumeLevelFeedback = new IntFeedback(() => { return _VolumeLevelForSig; }); MuteFeedback = new BoolFeedback(() => _IsMuted); - - StatusGet(); } /// @@ -148,11 +184,27 @@ namespace PepperDash.Essentials.Devices.Displays public override bool CustomActivate() { Communication.Connect(); + + var socket = Communication as ISocketStatus; + if (socket != null) + { + socket.ConnectionChange += new EventHandler(socket_ConnectionChange); + } + CommunicationMonitor.StatusChange += (o, a) => { Debug.Console(2, this, "Communication monitor state: {0}", CommunicationMonitor.Status); }; CommunicationMonitor.Start(); + + StatusGet(); + return true; } + void socket_ConnectionChange(object sender, GenericSocketStatusChageEventArgs e) + { + if (e.Client.IsConnected) + StatusGet(); + } + public override List Feedbacks { get @@ -267,12 +319,13 @@ namespace PepperDash.Essentials.Devices.Displays } case '\x01': { - _PowerIsOn = false; + _PowerIsOn = true; break; } } PowerIsOnFeedback.FireUpdate(); + Debug.Console(1, this, "PowerIsOn State: {0}", PowerIsOnFeedback.BoolValue); } else if (e.Text.IndexOf("\x4D\x49\x4E") > -1) @@ -286,6 +339,7 @@ namespace PepperDash.Essentials.Devices.Displays { _CurrentInputPort = newInput; CurrentInputFeedback.FireUpdate(); + Debug.Console(1, this, "Current Input: {0}", CurrentInputFeedback.StringValue); } } @@ -304,6 +358,7 @@ namespace PepperDash.Essentials.Devices.Displays { _VolumeLevelForSig = newVol; VolumeLevelFeedback.FireUpdate(); + Debug.Console(1, this, "Volume Level: {0}", VolumeLevelFeedback.IntValue); } } @@ -405,7 +460,13 @@ namespace PepperDash.Essentials.Devices.Displays { PowerGet(); + CrestronEnvironment.Sleep(100); + InputGet(); + + CrestronEnvironment.Sleep(100); + + VolumeGet(); } /// @@ -469,47 +530,47 @@ namespace PepperDash.Essentials.Devices.Displays public void InputHdmi1() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x09, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputHdmi1Value, 0x08, 0x0d }); } public void InputHdmi2() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x10, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputHdmi2Value, 0x08, 0x0d }); } public void InputHdmi3() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x11, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputHdmi3Value, 0x08, 0x0d }); } public void InputHdmi4() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x12, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputHdmi4Value, 0x08, 0x0d }); } public void InputHdmi5() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x17, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputHdmi5Value, 0x08, 0x0d }); } public void InputDisplayPort1() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x13, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputDisplayPort1Value, 0x08, 0x0d }); } public void InputVga1() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x00, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputVga1Value, 0x08, 0x0d }); } public void InputIpcOps() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x14, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputIpcOpsValue, 0x08, 0x0d }); } public void InputMediaPlayer() { - SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, 0x18, 0x08, 0x0d }); + SendBytes(new byte[] { 0x07, ID, 0x02, 0x4D, 0x49, 0x4E, InputMediaPlayerValue, 0x08, 0x0d }); } public void InputGet() diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs index 9bde21af..bf16f22d 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddleTechPageDriver.cs @@ -261,22 +261,45 @@ namespace PepperDash.Essentials.UIDrivers { i++; DisplayList.StringInputSig(i, 1).StringValue = display.Name; - DisplayList.GetBoolFeedbackSig(i, 1).SetSigFalseAction(display.PowerOn); - DisplayList.GetBoolFeedbackSig(i, 2).SetSigFalseAction(display.PowerOff); + DisplayList.GetBoolFeedbackSig(i, 1).SetSigFalseAction(display.PowerOn); + DisplayList.GetBoolFeedbackSig(i, 2).SetSigFalseAction(display.PowerOff); + if (display is TwoWayDisplayBase) + { + var powerOnSig = DisplayList.BoolInputSig(i, 1); + (display as TwoWayDisplayBase).PowerIsOnFeedback.LinkInputSig(powerOnSig); + + var powerOffSig = DisplayList.BoolInputSig(1, 2); + (display as TwoWayDisplayBase).PowerIsOnFeedback.LinkComplementInputSig(powerOffSig); + } DisplayList.GetBoolFeedbackSig(i, 3).SetSigFalseAction(() => { if (display is IInputHdmi1) (display as IInputHdmi1).InputHdmi1(); }); DisplayList.GetBoolFeedbackSig(i, 4).SetSigFalseAction(() => - { if (display is IInputHdmi2) (display as IInputHdmi2).InputHdmi2(); }); + { if (display is IInputHdmi2) (display as IInputHdmi2).InputHdmi2(); }); DisplayList.GetBoolFeedbackSig(i, 5).SetSigFalseAction(() => - { if (display is IInputHdmi3) (display as IInputHdmi3).InputHdmi3(); }); + { if (display is IInputHdmi3) (display as IInputHdmi3).InputHdmi3(); }); //DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() => //{ if (display is IInputHdmi4) (display as IInputHdmi4).InputHdmi4(); }); DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() => - { if (display is IInputDisplayPort1) (display as IInputDisplayPort1).InputDisplayPort1(); }); + { if (display is IInputDisplayPort1) (display as IInputDisplayPort1).InputDisplayPort1(); }); + + + // Figure out some way to provide current input feedback + if (display is TwoWayDisplayBase) + { + (display as TwoWayDisplayBase).CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); + } } + + } DisplayList.Count = i; + } + + + void CurrentInputFeedback_OutputChange(object sender, EventArgs e) + { + throw new NotImplementedException(); } /// diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index d1d14eaf..ce3897e2 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 35bcce9e..0987adf0 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ