Class RadioStatusRedactor

java.lang.Object
frc.spectrumLib.telemetry.RadioStatusRedactor
All Implemented Interfaces:
LogDataReceiver

public final class RadioStatusRedactor extends Object implements LogDataReceiver
Rewrites the radio's status JSON in "RadioStatus/Status" before any log file or dashboard gets it, keeping only fields known to be safe and blanking the rest.

AdvantageKit logs the radio's /status JSON every cycle and has no switch to turn that off. Logs go to the public log site, and the status holds the Wi-Fi key hashes, their salts and MAC addresses: a salted hash is enough to try the Wi-Fi key offline. A list of fields to blank misses whatever the next radio firmware adds, so this keeps a list of fields to log instead (ALLOWED), in the status and in its networkStatus24 / networkStatus6 objects. Every other value keeps its type but not its content: strings become "", numbers 0, booleans false, arrays and objects empty. A status that does not parse becomes {}.

Every data receiver is handed the same per-cycle copy of the log table, in the order they were added, so this one must be added before all the others (addFirst(LogDataReceiver...)). It runs on AdvantageKit's receiver thread and only rewrites that copy.

  • Constructor Details

    • RadioStatusRedactor

      public RadioStatusRedactor()
  • Method Details

    • addFirst

      public static void addFirst(LogDataReceiver... others)
      Adds a redactor as AdvantageKit's first data receiver, then the others in order. The way to add receivers, so none can be added ahead of the redactor.
      Parameters:
      others - the log writer, the dashboard publisher, ...
    • putTable

      public void putTable(LogTable table)
      Specified by:
      putTable in interface LogDataReceiver