//
// CRAM: CREATE Real-time Applications Manager
// See the copyright and acknowledgment of authors in the file COPYRIGHT
//
//// ClockService.h -- the CRAM clock server test class ////
//
// This is an example of a CRAM application; it simply logs the time every "mPeriod" seconds.
//

#ifndef __CLOCK_INCLUDE__
#define __CLOCK_INCLUDE__

#include "Server.h"

namespace cram {

using namespace std;

// The Clock Service class

class ClockService : public Server {

protected:				// protected members

	pthread_t mLoop;			// clock loop thread
	
	void start(void);			// start method
	void stop(void);			// stop method
	void suspend(void);			// suspend method
	void resume(void);			// resume method
	
								// set an option value
	void set_opt(const char * nam, const char * val);
	
public:					// These are public so that they can be accessed from the thread loop

	unsigned mPeriod;			// wait time in sec between messages
	bool mRunning;				// am I running?
	
						// Constructors
	ClockService(char * name, unsigned short lport, unsigned short eport) ;
	ClockService(char * name, unsigned short lport, unsigned short eport, unsigned period);
	~ClockService() { }
};

}

#endif

