#include "QueueLib.h"
// Project specific Queue access functions

void pushCheckin(void)
{
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 0;
  at_QTempData.ver = parm[14];
  at_QTempData.type = 35;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = (int)(voltageNow * 100);
  at_QTempData.etime = getEpochRtc();

  Serial.println("Pushing Voltage to Queue");
  atQ_push();
}

void pushDoorStatus(void)
{
  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 1;
  at_QTempData.type = 51;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = doorState;
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push Door Status to Queue");
  atQ_push();

  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 2;
  at_QTempData.type = 47;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = motorGetPosition(0);
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push Master Door Position to Queue");
  atQ_push();

  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 3;
  at_QTempData.type = 47;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = motorGetPosition(1);
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push Slave Door Position to Queue");
  atQ_push();

  // pushCheckin();
}

void pushNTP(uint32_t ep) // for testing to see how often NTP gets through
{
  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 99;
  at_QTempData.type = 53;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = ep;
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push NTP to Queue");
  atQ_push();
}

void pushMaxCurrents(void)
{
  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 4;
  at_QTempData.type = 47;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = getMaxCurrent(0);
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push Max Current 0");
  atQ_push();

  at_QTempData.ver = parm[14];
  at_QTempData.serial = parm[64];
  at_QTempData.chan = 5;
  at_QTempData.type = 47;
  at_QTempData.rssi = getWifiRSSI();
  at_QTempData.data = getMaxCurrent(1);
  at_QTempData.etime = getEpochRtc();

  Serial.println("Push Max Current 1");
  atQ_push();
}
