Skip to content

feat: add support for UdpClient in communication methods#1420

Open
jonnyarndt wants to merge 7 commits into
mainfrom
hotfix-udpClient-clean
Open

feat: add support for UdpClient in communication methods#1420
jonnyarndt wants to merge 7 commits into
mainfrom
hotfix-udpClient-clean

Conversation

@jonnyarndt
Copy link
Copy Markdown
Contributor

Summary

Adds a new udpClient control method and GenericUdpClient implementation while preserving the existing udp control method behavior.

Changes

  • add GenericUdpClient
  • add udpClient control method
  • update comm factory to map:
    • udp -> existing UDP behavior
    • udpClient -> new UDP client behavior
  • update related usage docs

Validation

  • solution builds successfully in Release
  • feature tested locally
  • no change to legacy udp mapping

Copilot AI review requested due to automatic review settings May 15, 2026 00:44
Copy link
Copy Markdown
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

Adds a new udpClient control method backed by a new GenericUdpClient class (built on System.Net.Sockets.UdpClient) while leaving the existing Udp mapping (which uses Crestron's UDPServer) untouched. The factory and config docs are updated to expose the new option.

Changes:

  • New GenericUdpClient device with auto-reconnect, stream-debugging hooks, and async receive loop.
  • New eControlMethod.UdpClient enum value, wired up in CommFactory.
  • Documentation updated to describe UdpClient vs Udp use cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
src/PepperDash.Core/Comm/GenericUdpClient.cs New UDP client implementation using System.Net.Sockets.UdpClient with reconnect/receive task.
src/PepperDash.Core/Comm/eControlMethods.cs Adds UdpClient enum member.
src/PepperDash.Essentials.Core/Comm and IR/CommFactory.cs Maps new UdpClient control method to GenericUdpClient.
docs/docs/usage/GenericComm.md Documents the new control method and when to use it.

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

Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment on lines +287 to +305
try
{
this.PrintSentBytes(bytes);

if (!IsConnected || client == null)
Connect();

var udpClient = client;
if (!IsConnected || udpClient == null)
return;

udpClient.Send(bytes, bytes.Length);
}
catch (Exception ex)
{
Debug.LogMessage(ex, "Error sending UDP bytes for {0}", this, Key);
HandleDisconnected();
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated in 4f2d2ca so GenericUdpClient.SendBytes now logs a warning when lazy Connect() still leaves the client unavailable, making dropped sends observable.

Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs Outdated
Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment thread src/PepperDash.Core/Comm/GenericUdpClient.cs
Comment thread docs/docs/usage/GenericComm.md Outdated
jonnyarndt and others added 2 commits May 15, 2026 13:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jonnyarndt and others added 2 commits May 15, 2026 13:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • crl.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build PepperDash.Essentials.4Series.sln -c Release (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/Essentials/PepperDash.Essentials.4Series.sln --packages /tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)
  • ocsp.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build PepperDash.Essentials.4Series.sln -c Release (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/Essentials/PepperDash.Essentials.4Series.sln --packages /tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/tmp/codeql-scratch-34409fe8f58e31ec/dbs/csharp/working/emptyFakeDotnetRoot /p:AllowMissingPrunePackageData=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

jonnyarndt and others added 2 commits May 15, 2026 13:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jonnyarndt jonnyarndt requested a review from ndorin May 15, 2026 22:24
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