// SPDX-License-Identifier: GPL-2.0-only
/*
 * Digital Voice Modem - Common Library
 * GPLv2 Open Source. Use is subject to license terms.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 *  Copyright (C) 2025 Bryan Biedenkapp, N2PLL
 *
 */
/**
 * @file LC_TDULC_RAW.h
 * @ingroup p25_lc
 * @file LC_TDULC_RAW.cpp
 * @ingroup p25_lc
 */
#if !defined(__P25_LC_TDULC__RAW_H__)
#define  __P25_LC_TDULC__RAW_H__

#include "common/Defines.h"
#include "common/p25/lc/TDULC.h"

namespace p25
{
    namespace lc
    {
        namespace tdulc
        {
            // ---------------------------------------------------------------------------
            //  Class Declaration
            // ---------------------------------------------------------------------------

            /**
             * @brief Implements a mechanism to generate raw TDULC data from bytes.
             * @ingroup p25_lc
             */
            class HOST_SW_API LC_TDULC_RAW : public TDULC {
            public:
                /**
                 * @brief Initializes a new instance of the LC_TDULC_RAW class.
                 */
                LC_TDULC_RAW();
                /**
                 * @brief Finalizes a instance of the LC_TDULC_RAW class.
                 */
                ~LC_TDULC_RAW();

                /**
                 * @brief Decode a terminator data unit w/ link control.
                 * @param[in] data Buffer containing a TDULC to decode.
                 * @returns bool True, if TDULC decoded, otherwise false.
                 */
                bool decode(const uint8_t* data) override;
                /**
                 * @brief Encode a terminator data unit w/ link control.
                 * @param[out] data Buffer to encode a TDULC.
                 */
                void encode(uint8_t* data) override;

                /**
                 * @brief Decode a terminator data unit w/ link control.
                 * @param[in] data Buffer containing a TDULC to decode.
                 * @param rawTDULC Flag indicating whether or not the passed buffer is raw.
                 * @returns bool True, if TDULC decoded, otherwise false.
                 */
                bool decode(const uint8_t* data, bool rawTDULC);
                /**
                 * @brief Encode a terminator data unit w/ link control.
                 * @param rawTDULC Flag indicating whether or not the output buffer is raw.
                 * @param[out] data Buffer to encode a TDULC.
                 */
                void encode(uint8_t* data, bool rawTDULC);

                /**
                 * @brief Sets the TDULC to encode.
                 * @param[in] tdulc Buffer containing TDULC to encode.
                 */
                void setTDULC(const uint8_t* tdulc);

            private:
                uint8_t* m_tdulc;
            };
        } // namespace tdulc
    } // namespace lc
} // namespace p25

#endif // __P25_LC_TDULC__RAW_H__
