package leigh.teremetori.sdk.producer;

import leigh.eo.EO;
import leigh.eo.EOLoop;
import leigh.esp.sdk.ESPClient;
import leigh.mecha.log.MechaLogger;
import leigh.mecha.log.MechaLoggerFactory;

/**
 * A source of telemetry to the Teremetori system.
 *
 * @author Alex Leigh
 */

public class TelemetrySource {
     private static final MechaLogger logger = MechaLoggerFactory.getLogger(TelemetrySource.class);
     private final ESPClient esp;
     private final String publishUri;
     private final EO currentValues = new EO();

     public TelemetrySource(ESPClient esp, String publishUri) {
          this.esp = esp;
          this.publishUri = publishUri;
     }

     public void update(EO channel, EO values, EOLoop events) {
          logger.info("Received updates: {}", values);
          currentValues.setAll(values);

          // TODO: Remove values that have not changed since last time
     }
}
