/*
 * TelemetryDispatcher.cpp
 *
 *  Created on: Dec 27, 2025
 *      Author: Gabriel
 */

#include "TelemetryDispatcher.hpp"

TelemetryDispatcher::TelemetryDispatcher(Queue<TelemetryPacket>* inQueue, HIDRAW* pHid) :
		Executable(Log::Level::Debug, "TelemetryDispatcher"),
		inQueue(inQueue),
		pHid(pHid)
{

}

TelemetryDispatcher::~TelemetryDispatcher() {

}

int32_t TelemetryDispatcher::init() {
	int32_t errors = 0;
	log(Log::Level::Informational, "Initalizing");
	log(Log::Level::Informational, "Initalzed with %d errors", errors);
	return errors;
}

int32_t TelemetryDispatcher::execute() {
	log(Log::Level::Informational, "Started execution");
	while(true){
		pHid->take(100);
		pHid->enqueueInPacket(reinterpret_cast<const uint8_t*>("\x01Hello World\n"), 14);
		pHid->give();
		vTaskDelay(1);
	}
	return 0;
}
