Skip to content
Snippets Groups Projects
Astri_Horn_Generic.h 2.56 KiB
Newer Older
Valerio Pastore's avatar
Valerio Pastore committed
/*
**************************************************************************
* Copyright (C) 2023 INAF
* 
* This program is free software: you can redistribute it and/or modify it 
* under the terms of the GNU Lesser General Public License as published by 
* the Free Software Foundation, either version 3 of the License
* or (at your option) any later version. This program is distributed
* in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even 
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
* See the GNU Lesser General Public License for more details. 
* You should have received a copy of the GNU Lesser General Public License 
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* 
* Authors:
* 
* <>Valerio Pastore INAF-OAS Bologna  valerio.pastore@inaf.it
****************************************************************************
*/
#pragma once

#include <Base_Packet.h>

namespace inaf::oasbo::Packets {

Valerio Pastore's avatar
Valerio Pastore committed
/**
 * @brief Represents a generic ASTRI horn packet.
 * @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 and provides
 * functionality specific to ASTRI horn packets.
 */
Valerio Pastore's avatar
.  
Valerio Pastore committed
class AstriHornGeneric: public inaf::oasbo::Packets::BasePacket {
Valerio Pastore's avatar
Valerio Pastore committed
	/**
	 * @brief Constructs an AstriHornGeneric object with the given packet structure.
	 * 
	 * @param structure The packet structure to be used.
	 */
Valerio Pastore's avatar
.  
Valerio Pastore committed
	AstriHornGeneric(inaf::oasbo::Packets::BasePacketStructure &structure) :
			BasePacket(structure) {
	}
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Gets the size of the header in bytes.
	 * 
	 * @return The size of the header.
	 */
	uint getHeaderSize() const override;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Gets the size of the payload in bytes.
	 * 
	 * @return The size of the payload.
	 */
	uint getPayloadSize() const override;
Valerio Pastore's avatar
Valerio Pastore committed

	/**
	 * @brief Gets the size of the tail in bytes.
	 * 
	 * @return The size of the tail.
	 */
	uint getTailSize() const override;
Valerio Pastore's avatar
Valerio Pastore committed

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

	/**
	 * @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;
};

Valerio Pastore's avatar
Valerio Pastore committed
}