Skip to content

Conversation

@andrew-welker
Copy link
Contributor

@andrew-welker andrew-welker commented Nov 14, 2025

This pull request introduces several improvements and bug fixes across the codebase, focusing on device registration logic, configuration parsing, interface implementation, and logging enhancements. The main themes are improved device registration for COM ports, more accurate parsing of UUIDs from URLs, better interface alignment for generic sinks, and refined logging for messenger subscription and status message handling.

Device Registration and Configuration:

  • Updated RegisterAndConfigureComPort in ComPortController.cs to only register COM ports if the parent is a CrestronControlSystem or CenIoCom102, improving device compatibility and reliability. Also, removed obsolete debug logging related to property changes and extended information events. [1] [2]

Configuration Parsing:

  • Improved regex patterns in EssentialsConfig.cs for SystemUuid and TemplateUuid to more accurately extract UUIDs from system and template URLs, handling new URL formats. [1] [2]

Device Interface Implementation:

  • Changed GenericSink to implement IRoutingSinkWithSwitchingWithInputPort instead of IRoutingSinkWithInputPort, added support for secondary audio signals, and implemented required members for input switching, ensuring correct routing behavior. [1] [2] [3]

Logging Improvements:

  • Enhanced logging in MessengerBase.cs by downgrading unnecessary warnings, improving debug information for client unsubscribes, and logging detailed error messages and stack traces for status message posting exceptions. [1] [2] [3] [4] [5]

Configuration Feedback:

  • Added a warning in MobileControlSystemController.cs to alert when messenger subscriptions are disabled, guiding users to enable the feature via configuration.
  • fix: enhance COM port registration logging and update GenericSink class for input switching
  • fix: parse current Portal URLS for system and template UUIDs correctly
  • fix: change how subscription state is logged to reduce traffic to console

Copilot finished reviewing on behalf of andrew-welker November 14, 2025 20:44
@ndorin ndorin merged commit 6d64fff into main Nov 14, 2025
6 checks passed
@ndorin ndorin deleted the mc-subscription-logging branch November 14, 2025 20:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements multiple fixes focused on improving logging behavior and updating Portal URL parsing logic. The changes reduce console traffic by adjusting log levels for subscription events, enhance error message clarity, and update URL regex patterns to correctly parse system and template UUIDs from current Portal URL formats.

Key Changes

  • Moved messenger subscription state logging from Information/Warning levels to Debug level to reduce console noise
  • Updated URL parsing regex patterns in EssentialsConfig to handle current Portal URL structure with /detail/ segments
  • Enhanced GenericSink class to implement IRoutingSinkWithSwitchingWithInputPort interface for improved routing support

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MobileControlSystemController.cs Added warning log when messenger subscriptions are disabled to help with configuration troubleshooting
MessengerBase.cs Reduced logging verbosity by removing redundant warnings and changing subscription event logs to Debug level; improved exception logging with separated error message and stack trace
GenericSink.cs Updated interface implementation to support input switching capabilities and added SecondaryAudio signal type support
RoutingFeedbackManager.cs Enabled verbose debug logging for destination updates to aid in routing troubleshooting
EssentialsConfig.cs Fixed regex patterns for SystemUuid and TemplateUuid extraction to handle current Portal URL format with /detail/ path segments; normalized indentation from tabs to spaces
Comments suppressed due to low confidence (6)

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

  • Variable destination may be null at this access as suggested by this null check.
                Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "Destination {destination} has not reported an input port yet", this,destination.Key);

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

  • Variable destination may be null at this access as suggested by this null check.
                    destination.CurrentSourceInfo = tempSourceListItem;                        ;

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

  • Variable destination may be null at this access as suggested by this null check.
                    destination.CurrentSourceInfo = tempSourceListItem;

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

  • Variable destination may be null at this access as suggested by this null check.
                Debug.LogMessage(Serilog.Events.LogEventLevel.Warning, "No room found for display {destination}", this, destination.Key);

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

  • Variable destination may be null at this access as suggested by this null check.
                destination.CurrentSourceInfoKey = "$transient";

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

  • Variable destination may be null at this access as suggested by this null check.
            destination.CurrentSourceInfoKey = sourceKey;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
if (!Config.EnableMessengerSubscriptions)
{
this.LogWarning("Messenger subscriptions disabled. add \"enableMessengerSubscriptions\": true to config for {key} to enable.", Key);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message formatting should have a space after the closing brace and before "to enable". The current format reads: "...for {key} to enable." but should be "...for {key} to enable."

Consider updating to:

this.LogWarning("Messenger subscriptions disabled. Add \"enableMessengerSubscriptions\": true to config for {key} to enable.", Key);

Also note the capitalization of "Add" for consistency.

Suggested change
this.LogWarning("Messenger subscriptions disabled. add \"enableMessengerSubscriptions\": true to config for {key} to enable.", Key);
this.LogWarning("Messenger subscriptions disabled. Add \"enableMessengerSubscriptions\": true to config for {key} to enable.", Key);

Copilot uses AI. Check for mistakes.
/// <inheritdoc />
public void ExecuteSwitch(object inputSelector)
{
throw new System.NotImplementedException();
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ExecuteSwitch method throws NotImplementedException, which will cause runtime errors when code attempts to switch inputs on a GenericSink device. Since the class now implements IRoutingSinkWithSwitchingWithInputPort, it should provide a proper implementation or at minimum log the attempt.

Consider implementing the method to handle input switching appropriately, or if input switching is intentionally not supported, provide a no-op implementation with appropriate logging:

public void ExecuteSwitch(object inputSelector)
{
    this.LogWarning("Input switching is not supported on GenericSink devices");
}
Suggested change
throw new System.NotImplementedException();
this.LogWarning("Input switching is not supported on GenericSink devices");

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants