/**
 * @file JATriangleWaveGAM.h
 * @brief Header file for class JATriangleWaveGAM
 * @date Jan, 2019
 * @author rhari
 *
 * @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
 * the Development of Fusion Energy ('Fusion for Energy').
 * Licensed under the EUPL, Version 1.1 or - as soon they will be approved
 * by the European Commission - subsequent versions of the EUPL (the "Licence")
 * You may not use this work except in compliance with the Licence.
 * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
 *
 * @warning Unless required by applicable law or agreed to in writing,
 * software distributed under the Licence is distributed on an "AS IS"
 * basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the Licence permissions and limitations under the Licence.

 * @details This header file contains the declaration of the class JATriangleWaveGAM
 * with all of its public, protected and private members. It may also include
 * definitions for inline methods which need to be visible to the compiler.
 */

#ifndef GAMS_JATRIANGLEWAVEGAM_H_
#define GAMS_JATRIANGLEWAVEGAM_H_

/*---------------------------------------------------------------------------*/
/*                        Standard header includes                           */
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/*                        Project header includes                            */
/*---------------------------------------------------------------------------*/

#include "GAM.h"

/*---------------------------------------------------------------------------*/
/*                           Class declaration                               */
/*---------------------------------------------------------------------------*/

/**
 * @brief GAM provides triangular waveform output within 1kHz thread.
 *
 * The configuration syntax is (names and signal quantity are only given as an example):
 * <pre>
 *      +CCPSWaveformGAM = {
 *           Class = JATriangleWaveGAM
 *           InputSignals = {
 *               Offset = {
 *                   Alias = OFFSET
 *                   DataSource = EPICSCAInput
 *                   Type = float32
 *               }
 *               Frequency = {
 *                   Alias = CCPS_OUTPUT_FREQ
 *                   DataSource = EPICSCAInput
 *                   Type = float32
 *               }
 *               Amplitude = {
 *                   Alias = CCPS_OUTPUT_AMP
 *                   DataSource = EPICSCAInput
 *                   Type = float32
 *               }
 *               PLCCCPSON = {
 *                   Alias = PLC_CCPSON
 *                   DataSource = EPICSCAInput
 *                   Type = uint32
 *               }
  *              READY = {
 *                   Alias = PLC_READY
 *                   DataSource = EPICSCAInput
 *                   Type = uint32
 *               }
 *           }
 *           OutputSignals = {
 *               CCPS_REF = {
 *                   DataSource = DDB1
 *                   Type = float32
 *               }
 *           }
 *       }
 * 
 * </pre>
 * 
 */

class JATriangleWaveGAM : public MARTe::GAM {
public:
    CLASS_REGISTER_DECLARATION()

    JATriangleWaveGAM();

    virtual ~JATriangleWaveGAM();

    virtual bool Initialise(MARTe::StructuredDataI & data);

    virtual bool Setup();

    virtual bool Execute();
private:
    // Input signal containing the frequency of the waveform.
    MARTe::float32 *frequency;

    // Input signal containing the amplitude of the waveform.
    MARTe::float32 *amplitude;

    // Input signal cantaining the offset of the waveform.
    MARTe::float32 *offset;

    // Input signal containing CCPS_ON_REQUEST
    //MARTe::uint32 *plcccpson;

    // Input signal condition CCPS_READY
    //MARTe::uint32 *plcReady;

    // Input signal condition CCPS_STANDBY
    MARTe::uint32 *plcStandby;

    MARTe::float32 *waveOutput;

    MARTe::float32 time;
};



/*---------------------------------------------------------------------------*/
/*                        Inline method definitions                          */
/*---------------------------------------------------------------------------*/

#endif /* GAMS_JATRIANGLEWAVEGAM_H_ */
