Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]-Trigger GenericCommMonitor Poll Inclusively #1222

Open
jonnyarndt opened this issue Mar 13, 2025 · 1 comment
Open

[FEATURE]-Trigger GenericCommMonitor Poll Inclusively #1222

jonnyarndt opened this issue Mar 13, 2025 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jonnyarndt
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The PepperDash.Essentials.Core GenericCommunicationMonitor polling mechanism does not start polling unless the GenericCommunicationMonitor client is of type iSocketStatus. A device with a com or udp communication method type does not trigger BeginPolling() within the GenericCommunicationMonitor subsequently not triggering the constructor item with signature object Action pollAction or pollString.

Describe the solution you'd like
Recommend removing BeginPolling() out of the if (!IsSocket) forcing BeginPolling() no matter if the client type is of iSocketStatus or not. This allows EPI devices to utilize the GenericCommunicationMonitor constructor object Action pollAction or pollString to implement polling, independent of the control method defined.

Describe alternatives you've considered
Change the BeginPolling() method accessor to include public override. However, I like the solution above better.

Additional context
None

Image

@ndorin
Copy link
Contributor

ndorin commented Mar 13, 2025

@jonnyarndt go ahead and remove the if(!IsSocket) conditional around the BeginPolling() call inside the Start() method.

While you're at it, I would also recommend inside the Start() method adding a line to deregister for the client.BytesReceived and client.TextReceived events before registering. Otherwise, calling Start() multiple times will cause multiple event registrations:

	public override void Start()
	{
            if (MonitorBytesReceived) 
            {
                     Client.BytesReceived -= Client_BytesReceived;
		    Client.BytesReceived += Client_BytesReceived;
          }
            else
            {
                   Client.TextReceived -= Client_TextReceived;
                   Client.TextReceived += Client_TextReceived;
            }

                BeginPolling();
            
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants