Skip to content

Commit c55de61

Browse files
committed
fix: enhance COM port registration logging and update GenericSink class for input switching
1 parent 42444ed commit c55de61

File tree

3 files changed

+21
-40
lines changed

3 files changed

+21
-40
lines changed

src/PepperDash.Essentials.Core/Comm and IR/ComPortController.cs

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,17 @@ private void RegisterAndConfigureComPort()
9191
return;
9292
}
9393

94-
var result = Port.Register();
95-
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
94+
95+
if (Port.Parent is CrestronControlSystem || Port.Parent is CenIoCom102)
9696
{
97-
this.LogError($"Cannot register {Key} using {Port.Parent.GetType().Name}-comport-{Port.ID} (result == {result})");
98-
return;
97+
var result = Port.Register();
98+
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
99+
{
100+
this.LogError($"Cannot register {Key} using {Port.Parent.GetType().Name}-comport-{Port.ID} (result == {result})");
101+
return;
102+
}
103+
this.LogInformation($"Successfully registered {Key} using {Port.Parent.GetType().Name}-comport-{Port.ID} (result == {result})");
99104
}
100-
this.LogInformation($"Successfully registered {Key} using {Port.Parent.GetType().Name}-comport-{Port.ID} (result == {result})");
101105

102106
var specResult = Port.SetComPortSpec(Spec);
103107
if (specResult != 0)
@@ -107,38 +111,6 @@ private void RegisterAndConfigureComPort()
107111
}
108112
this.LogInformation($"Successfully set comspec for {Key} using {Port.Parent.GetType().Name}-comport-{Port.ID} (result == {specResult})");
109113

110-
111-
// TODO [ ] - Remove debug logging once verified working
112-
// if (Port.Parent is CenIoCom102)
113-
// {
114-
// Port.PropertyChanged += (s, e) =>
115-
// {
116-
// this.LogInformation($@"RegisterAndConfigureComPort: PropertyChanged Fired >>
117-
// comPort-'{Port.ID}',
118-
// Property Changed-'{e.Property}',
119-
// Value Changed-'{e.Value}',
120-
// deviceName-'{Port.DeviceName}',
121-
// parentDevice-'{Port.ParentDevice}',
122-
// parent-`{Port.Parent}`,
123-
// online-`{Port.IsOnline}`,
124-
// present-`{Port.Present}`,
125-
// supportedBaudRates-'{Port.SupportedBaudRates}'");
126-
// };
127-
// Port.ExtendedInformationChanged += (s, e) =>
128-
// {
129-
130-
// this.LogInformation($@"RegisterAndConfigureComPort: ExtendedInformationChanged Fired >>
131-
// comPort-'{Port.ID}',
132-
// {e.Protocol},
133-
// {e.BaudRate},
134-
// {e.Parity},
135-
// {e.DataBits},
136-
// {e.StopBits},
137-
// HW Handshake-'{e.HardwareHandshakeSetting}',
138-
// SW Handshake-'{e.SoftwareHandshakeSetting}'");
139-
// };
140-
// }
141-
142114
Port.SerialDataReceived += Port_SerialDataReceived;
143115
}
144116

src/PepperDash.Essentials.Core/Routing/RoutingFeedbackManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private void HandleSinkUpdate(IRoutingSinkWithSwitching sender, RoutingInputPort
9898
/// <param name="inputPort">The currently selected input port on the destination device.</param>
9999
private void UpdateDestination(IRoutingSinkWithSwitching destination, RoutingInputPort inputPort)
100100
{
101-
// Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Updating destination {destination} with inputPort {inputPort}", this,destination?.Key, inputPort?.Key);
101+
Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Updating destination {destination} with inputPort {inputPort}", this, destination?.Key, inputPort?.Key);
102102

103103
if(inputPort == null)
104104
{

src/PepperDash.Essentials.Devices.Common/Generic/GenericSink.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace PepperDash.Essentials.Devices.Common.Generic
99
/// <summary>
1010
/// Represents a GenericSink
1111
/// </summary>
12-
public class GenericSink : EssentialsDevice, IRoutingSinkWithInputPort
12+
public class GenericSink : EssentialsDevice, IRoutingSinkWithSwitchingWithInputPort
1313
{
1414
/// <summary>
1515
/// Initializes a new instance of the GenericSink class
@@ -20,7 +20,7 @@ public GenericSink(string key, string name) : base(key, name)
2020
{
2121
InputPorts = new RoutingPortCollection<RoutingInputPort>();
2222

23-
var inputPort = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
23+
var inputPort = new RoutingInputPort(RoutingPortNames.AnyVideoIn, eRoutingSignalType.AudioVideo | eRoutingSignalType.SecondaryAudio, eRoutingPortConnectionType.Hdmi, null, this);
2424

2525
InputPorts.Add(inputPort);
2626
}
@@ -66,6 +66,15 @@ public SourceListItem CurrentSourceInfo
6666
/// Event fired when the current source changes
6767
/// </summary>
6868
public event SourceInfoChangeHandler CurrentSourceChange;
69+
70+
/// <inheritdoc />
71+
public event InputChangedEventHandler InputChanged;
72+
73+
/// <inheritdoc />
74+
public void ExecuteSwitch(object inputSelector)
75+
{
76+
throw new System.NotImplementedException();
77+
}
6978
}
7079

7180
/// <summary>

0 commit comments

Comments
 (0)