//
// 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 http://www.gnu.org/licenses/.
//

#ifndef DATAGENERATORLAYER_H_
#define DATAGENERATORLAYER_H_

#include <assert.h>
#include "BaseApplLayer.h"
#include "ApplPkt_m.h"
//-----------------------
#include "PassedMessage.h"
#include "NetwControlInfo.h"
#include <SimpleAddress.h>
#include "utils/ExtendedAddress.h"


/**
 * @brief Base class for the application layer
 *
 * This is the generic class for all application layer modules. If you
 * want to implement your own application layer you have to subclass your
 * module from this class.
 *
 * @ingroup applLayer
 * @ingroup baseModules
 *
 * @author Daniel Willkomm
 **/
class DataGeneratorLayer : public BaseApplLayer {
public:

    enum ExtApplMessageKinds{
		LAST_BASE_APPL_MESSAGE_KIND,
		DATA_MESSAGE,
    };

	enum SelfMessages {
		SEND_DATA_TIMER,
	};

protected:
	/**
	 * @brief Length of the ApplPkt header
	 **/
    cMessage *delayTimer;
    double sensingTime;

public:
	/** @brief Initialization of the module and some variables*/
	virtual void initialize(int);
	virtual void finish();

protected:
	/**
	 * @brief Return my application layer address
	 *
	 * We use the node module index as application address
	 **/
	virtual const int myApplAddr();

    /** @brief Handle self messages such as timer... */
    virtual void handleSelfMsg(cMessage*);

    void sendData();

    void handleHostState(const HostState& state);

};

#endif
 /* EXTAPPLLAYER_H_ */
