package com.easternedgerobotics.rov.value;

public class HeartbeatValue implements MutableValueCompanion<Heartbeat> {

    /**
     * Creates a HeartbeatValue with the operational value off.
     *
     * @return a zero HeartbeatValue
     */
    public static HeartbeatValue zero() {
        return new HeartbeatValue(new Heartbeat());
    }

    /**
     * Creates a HeartbeatValue with the given values.
     *
     * @param operational the status of rov operation
     * @return a HeartbeatValue
     */
    public static HeartbeatValue create(
        final boolean operational
    ) {
        final Heartbeat heartbeat = new Heartbeat();
        heartbeat.operational = operational;
        return new HeartbeatValue(heartbeat);
    }

    private final Heartbeat heartbeat;

    HeartbeatValue(final Heartbeat hb) {
        this.heartbeat = hb;
    }

    public final boolean isOperational() {
        return heartbeat.operational;
    }

    @Override
    public final Heartbeat asMutable() {
        return heartbeat;
    }

    @Override
    public final String toString() {
        return String.format(
            "Heartbeat={%d}",
            heartbeat.operational
        );
    }
}

@@ -1134,17 +1134,17 @@
 tbeat=%7B%25
-d
+b
 %7D%22,%0A    

Fix HeartbeatValue string format specifier