#pragma once

#include "robbase.h"

#include "Robot.h"

//过渡状态机
class ROBBASE_API CTransitState
{
public:
	CTransitState(void);
	~CTransitState(void);

	void Reset();
	
	//客户线程
	void Seek(int state);
	int  Wait(DWORD actId, int timeout );
	BOOL IsStateAccord();

	//服务线程
	int  GetTargetState();
	BOOL IsStateRequested();

	void Ack(int state);

public:
	CRobot* m_pRobot;
	TCHAR  m_strName[ROB_MAX_SYNCOBJ_NAME_LEN];

private:
	CRITICAL_SECTION m_cs;
	int m_nTargetState;
	int m_nActualState;
};

