#include "capabilities.h"

Capabilities::Capabilities() {
  this->rgb = false;
  this->aec = false;
  this->agc = false;
  this->hdr = false;
  this->roi = false;
  this->bin = false;
  this->skip = false;
  this->flip = false;
  this->test = false;
}

bool Capabilities::setCapabilities(QByteArray &data) {
  if (data.length() == 9) {
    this->rgb = data[0];
    this->aec = data[1];
    this->agc = data[2];
    this->hdr = data[3];
    this->roi = data[4];
    this->bin = data[5];
    this->skip = data[6];
    this->flip = data[7];
    this->test = data[8];
    return true;
  }
  return false;
}

QTextStream &operator<<(QTextStream &out, Capabilities cap) {
  out << "{\n";
  out << tab << CMOCapabRGBText << ": " << cap.rgb << endValue;
  out << tab << CMOCapabAECText << ": " << cap.aec << endValue;
  out << tab << CMOCapabAGCText << ": " << cap.agc << endValue;
  out << tab << CMOCapabHDRText << ": " << cap.hdr << endValue;
  out << tab << CMOCapabROIText << ": " << cap.roi << endValue;
  out << tab << CMOCapabBinText << ": " << cap.bin << endValue;
  out << tab << CMOCapabSkipText << ": " << cap.skip << endValue;
  out << tab << CMOCapabFlipText << ": " << cap.flip << endValue;
  out << tab << CMOCapabTestText << ": " << cap.test << endValue;
  out << "}";
  return out;
}
