Exemplo n.º 1
0
void Rotating::HandleTrigger(HOBJECT hSender, HSTRING hMsg)
{
	CServerDE* pServerDE = BaseClass::GetServerDE();
	if (!pServerDE) return;

	char* pMsg = pServerDE->GetStringData(hMsg);
	if (!pMsg || !pMsg[0]) return;

	if (m_eState == RWM_OFF && _mbsicmp((const unsigned char*)pMsg, (const unsigned char*)TRIGGER_MSG_ON) == 0)
	{
		SetSpinUp();
		pServerDE->SetNextUpdate(m_hObject, RWM_UPDATE_DELTA);
	}
	else if (m_eState != RWM_OFF && _mbsicmp((const unsigned char*)pMsg, (const unsigned char*)TRIGGER_MSG_OFF) == 0)
	{
		SetSpinDown();
		pServerDE->SetNextUpdate(m_hObject, RWM_UPDATE_DELTA);
	}
	else if (_mbsicmp((const unsigned char*)pMsg, (const unsigned char*)TRIGGER_MSG_TOGGLE) == 0)
	{
		if (m_eState == RWM_OFF)
			SetSpinUp();
		else
			SetSpinDown();
		pServerDE->SetNextUpdate(m_hObject, RWM_UPDATE_DELTA);
	}
}
void RotatingWorldModel::HandleTrigger(HOBJECT hSender, const char* szMsg)
{
	if (m_eState == RWM_OFF && stricmp(szMsg, TRIGGER_MSG_ON) == 0)
	{
		SetSpinUp();
		SetNextUpdate(RWM_UPDATE_DELTA);
	}
	else if (m_eState == RWM_NORMAL && stricmp(szMsg, TRIGGER_MSG_OFF) == 0)
	{
		SetSpinDown();
		SetNextUpdate(RWM_UPDATE_DELTA);
	}
}