Package com.ultikits.ultitools.utils
Class AgentSettings
java.lang.Object
com.ultikits.ultitools.utils.AgentSettings
The operator settings the panel mirrors next to its remote controls: the
settings
object of the opening hello, and a settings.changed payload only when the value
differs from the last one reported.
The contract keeps capabilities fixed for the life of a session but lets operator settings change
mid-session, so a switch that flips while the panel is connected is reported once through
settings.changed and the panel greys its control without a new handshake.
changedSinceLastReport() is a pure comparison: the caller sends the payload and then
calls markReported(JsonObject), which is what makes the next call return null again.
Before the first markReported every call returns the current settings; the wiring calls
it right after handing hello to the socket, so an unchanged value is never repeated.
Package-private framework plumbing; not for module use.
- Since:
- 6.3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BooleanSupplierprivate com.google.gson.JsonObjectThe last settings object handed to the panel, or null before the first report. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) com.google.gson.JsonObjectThe settings payload to send assettings.changed, or null when nothing changed.(package private) com.google.gson.JsonObjectBuilds the settings object the openinghellocarries.(package private) voidmarkReported(com.google.gson.JsonObject settings) Records what was just handed to the panel, so the same value is not reported again.
-
Field Details
-
powerEnabled
-
reported
private volatile com.google.gson.JsonObject reportedThe last settings object handed to the panel, or null before the first report.
-
-
Constructor Details
-
AgentSettings
AgentSettings(BooleanSupplier powerEnabled) Creates the helper.- Parameters:
powerEnabled- the operator'sultipanel.capabilities.power-actionsswitch
-
-
Method Details
-
helloSettings
com.google.gson.JsonObject helloSettings()Builds the settings object the openinghellocarries.- Returns:
{ powerActionsEnabled }as the contract's hello settings schema requires
-
changedSinceLastReport
com.google.gson.JsonObject changedSinceLastReport()The settings payload to send assettings.changed, or null when nothing changed.- Returns:
- a fresh payload object, or null when the current value equals the last reported one
-
markReported
void markReported(com.google.gson.JsonObject settings) Records what was just handed to the panel, so the same value is not reported again.- Parameters:
settings- the payload that was sent; a defensive copy is kept
-