#include "GpsDummy.h"

#include <mission/devices/devicedefinitions/GPSDefinitions.h>

GpsDummy::GpsDummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie)
    : DeviceHandlerBase(objectId, comif, comCookie) {}

GpsDummy::~GpsDummy() {}

void GpsDummy::doStartUp() {}

void GpsDummy::doShutDown() {}

ReturnValue_t GpsDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; }

ReturnValue_t GpsDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
  return NOTHING_TO_SEND;
}

ReturnValue_t GpsDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
                                                const uint8_t *commandData, size_t commandDataLen) {
  return returnvalue::OK;
}

ReturnValue_t GpsDummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
                                     size_t *foundLen) {
  return returnvalue::OK;
}

ReturnValue_t GpsDummy::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
  return returnvalue::OK;
}

void GpsDummy::fillCommandAndReplyMap() {}

uint32_t GpsDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }

ReturnValue_t GpsDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
                                                LocalDataPoolManager &poolManager) {
  localDataPoolMap.emplace(GpsHyperion::LATITUDE, new PoolEntry<double>({0.0}, 1));
  localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}, 1));
  localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
  localDataPoolMap.emplace(GpsHyperion::SPEED, new PoolEntry<double>({7684.2}));
  localDataPoolMap.emplace(GpsHyperion::FIX_MODE, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::SATS_IN_USE, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::SATS_IN_VIEW, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::YEAR, new PoolEntry<uint16_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::MONTH, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::DAY, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::HOURS, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::MINUTES, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::SECONDS, new PoolEntry<uint8_t>({0}));
  localDataPoolMap.emplace(GpsHyperion::UNIX_SECONDS, new PoolEntry<uint32_t>({0}));

  return returnvalue::OK;
}