#pragma once

//#include "bombax.h"
#include "robbase.h"


class ROBBASE_API CSoftTrigger
{
public:

	//触发类型和电平 
	enum {
	    STT_RISING  = 1,
		STT_FAILING = (1<<1),
		STT_HIGH    = (1<<2),
		STT_LOW     = (1<<3),
	};

	CSoftTrigger(int bit, int type , int nInitLevel, int period =1000);
	CSoftTrigger();

	~CSoftTrigger(void);
	
	//返回TRUE，表示可以触发。
	BOOL Check(int level, int& trigType);
 

	void Reset(int initLevel);

public:
	int  m_nType;
	int  m_nCurLevel;
	int  m_nPeriod;  //触发周期,ms

	int  m_nBit;  //输入位号，外部参考用
protected:
	double m_timestamp;

};

