Skip to content
Snippets Groups Projects
Astri_MA_Generic.h 4.25 KiB
#pragma once

#include <Base_Packet.h>

namespace inaf::oasbo::Packets {

/**
 * @brief The AstriMaGeneric class represents a generic packet used in the ASTRI DAQ system.
 * 
 * @note the "magic numbers" in the implementation of this class derived from the ASTRI Camera BEE – Camera Camera Data Acquisition
 * Interface Control Document.
 * If the document is updated, be sure to update the magic numbers appropriately. 
 * This class inherits from the BasePacket class in the inaf::oasbo::Packets namespace.
 * It provides methods to retrieve various properties of the packet, such as header size, payload size, tail size,
 * telescope ID, type, subtype, SSC, packet length, date and time information, event counter, and various flags.
 */
class AstriMaGeneric: public inaf::oasbo::Packets::BasePacket {

public:
	/**
	 * @brief Constructs an AstriMaGeneric object with the given packet structure.
	 * 
	 * @param structure The packet structure.
	 */
	AstriMaGeneric(inaf::oasbo::Packets::BasePacketStructure &structure) :
			BasePacket(structure) {
	}

	/**
	 * @brief Constructs an AstriMaGeneric object by copying another BasePacket object.
	 * 
	 * @param other The other BasePacket object to copy.
	 */
	AstriMaGeneric(inaf::oasbo::Packets::BasePacket &other) :
			BasePacket(other) {
	}

	/**
	 * @brief Gets the size of the header in bytes.
	 * 
	 * @return The size of the header.
	 */
	uint getHeaderSize() const override;

	/**
	 * @brief Gets the size of the payload in bytes.
	 * 
	 * @return The size of the payload.
	 */
	uint getPayloadSize() const override;

	/**
	 * @brief Gets the size of the tail in bytes.
	 * 
	 * @return The size of the tail.
	 */
	uint getTailSize() const override;

	/**
	 * @brief Checks if the packet has a recognized header.
	 * 
	 * @return True if the packet has a recognized header, false otherwise.
	 */
	bool hasRecognizedHeader() const override;

	/**
	 * @brief Checks if the given buffer contains a recognized header.
	 * 
	 * @param buff The buffer to check.
	 * @return True if the buffer contains a recognized header, false otherwise.
	 */
	bool isRecognizedHeader(std::vector<uint8_t> buff) const override;

	/**
	 * @brief Gets the telescope ID field value.
	 * 
	 * @return The telescope ID value.
	 */
	uint getTelescopeID() const;

	/**
	 * @brief Gets the type of the packet.
	 * 
	 * @return The packet type.
	 */
	uint getType() const;

	/**
	 * @brief Gets the subtype of the packet.
	 * 
	 * @return The packet subtype.
	 */
	uint getSubType() const;

	/**
	 * @brief Gets the SSC field value.
	 * 
	 * @return The SSC value.
	 */
	uint getSSC() const;

	/**
	 * @brief Gets the packetlength field value.
	 * 
	 * @return The packet length.
	 */
	uint getPacketLength() const;

	/**
	 * @brief Gets the year field value.
	 * 
	 * @return The year.
	 */
	uint getYear() const;

	/**
	 * @brief Gets the month field value.
	 * 
	 * @return The month.
	 */
	uint getMonth() const;

	/**
	 * @brief Gets the day field value.
	 * 
	 * @return The day.
	 */
	uint getDay() const;

	/**
	 * @brief Gets the hour field value.
	 * 
	 * @return The hour.
	 */
	uint getHour() const;

	/**
	 * @brief Gets the minutes field value.
	 * 
	 * @return The minutes.
	 */
	uint getMinutes() const;

	/**
	 * @brief Gets the seconds field value.
	 * 
	 * @return The seconds.
	 */
	uint getSeconds() const;

	/**
	 * @brief get the validtime field value
	 * 
	 * @return validtime
	 */
	bool getValidTime() const;

	/**
	 * @brief Gets the time tag nanoseconds field value
	 * 
	 * @return  time tag nanoseconds.
	 */
	uint getTimeTagNanoseconds() const;

	/**
	 * @brief Gets the event counter field value.
	 * 
	 * @return The event counter.
	 */
	uint getEventCounter() const;

	/**
	 * @brief get the lif field value.
	 * 
	 * @return lid value
	 */
	bool getLid() const;

	/**
	 * @brief get the fibst field value.
	 * 
	 * @return fibst value.
	 */
	bool fibSt() const;

	/**
	 * @brief get the fibCont field value.
	 * 
	 * @return fibCont value.
	 */
	bool fibCont() const;

	/**
	 * @brief get the fibPuls field value.
	 * 
	 * @return fibPuls value.
	 */
	bool fibPuls() const;

	/**
	 * @brief get the rgbCont field value.
	 * 
	 * @return rgbCont value.
	 */
	uint rgbCont() const;

	/**
	 * @brief get the rgbPuls field value.
	 * 
	 * @return rgbPuls value.
	 */
	uint rgbPuls() const;
};
}