//*******************************************************************************
//*  Copyright (c) Federal University of Para, Brazil - 2012			*
//*  Developed at the Research Group on Computer Network and Multimedia		*
//*  Communication (GERCOM)							*
//*  All rights reserved							*
//*										*
//*  Permission to use, copy, modify, and distribute this protocol and its	*
//*  documentation for any purpose, without fee, and without written		*
//*  agreement is hereby granted, provided that the above copyright notice,	*
//*  and the author appear in all copies of this protocol.			*
//*										*
//*  Version:  0.1								*
//*  Author(s): Denis do Rosário <denis@ufpa.br>				*
//*										*
//******************************************************************************/

#ifndef VIDEOAPP_H_
#define VIDEOAPP_H_

#include "WiseBaseApplication.h"
#include "VirtualMobilityManager.h"

enum ValueReportingTimers {
	REQUEST_MULTIMEDIA 	= 1,
};

/*
 * Base class for criticality-based sensor nodes.
 */
class VideoApp: public WiseBaseApplication {
public:
    VideoApp();
    virtual ~VideoApp();

protected:
    struct video{
	int ch;
	int sn;
	int id;
	FILE *pFile;
    };

    virtual void initialize();
    virtual void startup() {}
    virtual void finish();
    virtual void finishSpecific() {};
    virtual void fromNetworkLayer(cPacket* pkt, const char* src, double rssi, double lqi);
    virtual void handleMobilityControlMessage(MobilityManagerMessage *);
    virtual void handleSensorReading(WiseSensorMessage* msg);
    virtual void handleDirectApplicationMessage(WiseApplicationPacket* pkt);

    void processAppPacket(WiseApplicationPacket* pkt);
    void timerFiredCallback(int);
    void writeRdTrace(int id,int seqNum);
    void AddReceivedTrace (double, bool, TraceInfo tParam);

    bool isSink;
    std::list<video> set;
    std::list<video>::iterator crtlIterator;
    int idVideo;
};

#endif /* CRITAPP_H_ */
