Skip to content

Conversation

gbakeman
Copy link
Contributor

It looks like the stop action system was disabled during the client library changes. I've reactivated it.
I've also redone how UPS statuses are updated and processed, in the hopes of making program execution more efficient and bug-Closes #27

- Gave it the FlagsAttribute, to indicate that multiple enums can be used together (as flags)
- Removed manual value assignments in favor of compiler assignments
- Added default None value
UPS_Status property is now a UPS_States type.
- Removed Shutdown_Condition and Stop_Shutdown events in favor of one StatusesChanged event
- Rewrote the status updating portion of Retrieve_UPS_Datas to try and make it more efficient, and allow the client to handle changes in status.
- Moved handling of status changes into WinNUT.vb, and reactivated disabled stop system.
@gbakeman gbakeman added bug Something isn't working enhancement New feature or request labels Oct 10, 2022
@gbakeman gbakeman added this to the 2.2 Stable Release milestone Oct 10, 2022
@gbakeman gbakeman self-assigned this Oct 10, 2022
@gbakeman gbakeman linked an issue Oct 10, 2022 that may be closed by this pull request
Modify the logic for handling a UPS status update which will prevent the None status from always showing up. Also log the program version on startup.
Also updating how notification messages determine if the UPS is on line or not.
Relocated it to a regularly-called subroutine to shutdown conditions are always being checked while on battery.
Fix NRE error on initialization, and cleanup code.
- NutSocket should not try to gracefully disconnect if it isn't already connected
- Also made NutSocket less chatty. Upper-level classes handle that.
- Updated ConnectionError event in UPS to include the UPS object.
- Propagated connection handling changes to WinNUT.vb
- Removed some commented out code from the Globals file.
- Not sure why we're making a Windows API call for power state change requests when the call already exists in the Windows.Forms class. Using that instead (works for me (tm))
- Adding some additional log messages as well
Ran into a situation where my UPS was reporting DATA-STALE errors for all variables. I was able to cleanup code a bit to prevent crashes, but this still doesn't communicate the error to the user, and worse still substitutes default values when it shouldn't be.
- Cleanup GetUPSVar and fix the DATA-STALE handling code so it runs properly.
- Requesting ups.status variable defaults to "None" now.
Apparently, Windows is not very consistent with reporting PowerModeChanged events so we need to account for that. Suspend code now runs in the Shutdown action to keep WinNUT in a more consistent state between power mode changes.
WinNUT GUI shouldn't be making decisions about connection logic based on errors, since these errors can arise during reconnect attempts. Also make another attempt at useful debug output on PowerModeChangedEvent.
It appears that if WinNUT resumes operation from a suspended state and the computer's networking is not prepared for a connection, then WinNUT will only try reconnecting once and hard-fail without launching a reconnection timer. Connect_UPS has been modified so that it will launch the reconnection timer if required by the caller.
- Reconnection interval is now 5 seconds regardless of compiler constants
@gbakeman gbakeman merged commit f6206b9 into Dev-2.2 Oct 14, 2022
@gbakeman gbakeman deleted the sleepmode branch October 14, 2022 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sleep Mode not working
1 participant