Class AgentSettings

java.lang.Object
com.ultikits.ultitools.utils.AgentSettings

final class AgentSettings extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    private final BooleanSupplier
     
    private com.google.gson.JsonObject
    The last settings object handed to the panel, or null before the first report.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the helper.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) com.google.gson.JsonObject
    The settings payload to send as settings.changed, or null when nothing changed.
    (package private) com.google.gson.JsonObject
    Builds the settings object the opening hello carries.
    (package private) void
    markReported(com.google.gson.JsonObject settings)
    Records what was just handed to the panel, so the same value is not reported again.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • powerEnabled

      private final BooleanSupplier powerEnabled
    • reported

      private volatile com.google.gson.JsonObject reported
      The 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's ultipanel.capabilities.power-actions switch
  • Method Details

    • helloSettings

      com.google.gson.JsonObject helloSettings()
      Builds the settings object the opening hello carries.
      Returns:
      { powerActionsEnabled } as the contract's hello settings schema requires
    • changedSinceLastReport

      com.google.gson.JsonObject changedSinceLastReport()
      The settings payload to send as settings.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