feat: add support for UdpClient in communication methods#1420
feat: add support for UdpClient in communication methods#1420jonnyarndt wants to merge 7 commits into
Conversation
…t GenericUdpClient class
There was a problem hiding this comment.
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
GenericUdpClientdevice with auto-reconnect, stream-debugging hooks, and async receive loop. - New
eControlMethod.UdpClientenum value, wired up inCommFactory. - Documentation updated to describe
UdpClientvsUdpuse 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.
| 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(); | ||
| } | ||
| } |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Updated in 4f2d2ca so GenericUdpClient.SendBytes now logs a warning when lazy Connect() still leaves the client unavailable, making dropped sends observable.
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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/PepperDash/Essentials/sessions/761a7a78-c51f-474b-9000-baa9a232c0d0 Co-authored-by: jonnyarndt <21110580+jonnyarndt@users.noreply.github.com>
|
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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… valid traffic arrival
Summary
Adds a new
udpClientcontrol method andGenericUdpClientimplementation while preserving the existingudpcontrol method behavior.Changes
GenericUdpClientudpClientcontrol methodudp-> existing UDP behaviorudpClient-> new UDP client behaviorValidation
Releaseudpmapping