#ifndef LRSSAMPLER_H
#define LRSSAMPLER_H

#include "microperiodichandler.h"
#include "callback.h"
#include "lrseventsC.h"
#include "alarm.h"
#include "lrscfg.h"

// Forward declarations
class LrsApp;
class Supplier;
class HousekeepingSensors;

#define HOUSEKEEPING_SAMPLE_PERIOD 5000 //Sample all housekeeping sensors every 5 seconds
#define WATER_SAMPLE_PERIOD 1000	//Sample all water sensors every second

/*----------------------------------------------------------------
CLASS 
	LrsSampler

DESCRIPTION
	LrsSampler creates callback objects and supplies them to 
	MicroPeriodicHandler. 

AUTHOR
	D.Cline. Copyright 2001 MBARI.
----------------------------------------------------------------*/
class LrsSampler : public MicroPeriodicHandler
{
public:	
	// Constructor
	// [input] name: application name
	// [input] app: Parent LrsApp
    LrsSampler(const char *name, LrsApp *pApp);

	virtual ~LrsSampler();


	// Callback object for sampling can housekeeping sensors
	// samples and pushes to the <Supplier> for the client to display
	void sampleAllSensors(CallbackObject *obj);
	

	// Sampler water sensor. Use to sample water sensor
	// at a higher rate than default rate in sampleAllSensors above
	void sampleWaterSensors(CallbackObject *obj);

private:
	
	// corba event supplier to push callback data to client
	Supplier *_pSupplier; 
	
	// Pointer reference to houskeeping sensors instances
	HousekeepingSensors *_pSensor[NUM_HOUSINGS];	
	
	// Callback objects used to sample sensors
	CallbackObject _cbHousekeeping;

	// Callback objects used to sample sensors
	CallbackObject _cbWaterAlarm;

	// Timed water alarm object. Used to detect, and manage alarms
	TimedAlarm _waterAlarmElectHousing;
	TimedAlarm _waterAlarmSpectHousing;
};

#endif
