// {{{RME classifier 'Logical View::DetectarObstaculo'

#if defined( PRAGMA ) && ! defined( PRAGMA_IMPLEMENTED )
#pragma implementation "DetectarObstaculo.h"
#endif

#include <RTSystem/DetectarObstaculoComponent.h>
#include <DetectarObstaculo.h>
#include <LerSonarEsquerdo.h>

// {{{RME classifier 'Logical View::DetectarObstaculo' tool 'OT::Cpp' property 'ImplementationPreface'
// {{{USR tool 'OT::Cpp' property 'ImplementationPreface'
// }}}USR
// }}}RME

static RTActor * new_DetectarObstaculo_Actor( RTController * _rts, RTActorRef * _ref )
{
	return new DetectarObstaculo_Actor( _rts, _ref );
}

const RTActorClass DetectarObstaculo =
{
	(const RTActorClass *)0
  , "DetectarObstaculo"
  , (RTVersionId)0
  , 0
  , (const RTRelayDescriptor *)0
  , new_DetectarObstaculo_Actor
};

static const char * const rtg_state_names[] =
{
	"TOP"
  , "AguardandoDadosSonares"
  , "CalculandoTrajetoria"
  , "DesviandoObstaculo"
};

#define SUPER RTActor

DetectarObstaculo_Actor::DetectarObstaculo_Actor( RTController * rtg_rts, RTActorRef * rtg_ref )
	: RTActor( rtg_rts, rtg_ref )
{
}

DetectarObstaculo_Actor::~DetectarObstaculo_Actor( void )
{
}

// {{{RME classifier 'Logical View::DetectarObstaculo' operation 'RecebeDadosSensores()'
void DetectarObstaculo_Actor::RecebeDadosSensores( void )
{
	// {{{USR operation 'RecebeDadosSensores()'
	// }}}USR
}
// }}}RME

// {{{RME classifier 'Logical View::DetectarObstaculo' operation 'EnviaDadosNavegacao()'
void DetectarObstaculo_Actor::EnviaDadosNavegacao( void )
{
	// {{{USR operation 'EnviaDadosNavegacao()'
	// }}}USR
}
// }}}RME

INLINE_CHAINS void DetectarObstaculo_Actor::chain1_Initial( void )
{
	// transition ':TOP:Initial:Initial'
	rtgChainBegin( 1, "Initial" );
	rtgTransitionBegin();
	rtgTransitionEnd();
	enterState( 2 );
}

void DetectarObstaculo_Actor::rtsBehavior( int signalIndex, int portIndex )
{
	for( int stateIndex = getCurrentState(); ; stateIndex = rtg_parent_state[ stateIndex - 1 ] )
		switch( stateIndex )
		{
		case 1:
			// {{{RME classifier 'Logical View::DetectarObstaculo' state ':TOP'
			switch( portIndex )
			{
			case 0:
				switch( signalIndex )
				{
				case 1:
					chain1_Initial();
					return;
				default:
					break;
				}
				break;
			default:
				break;
			}
			unexpectedMessage();
			return;
			// }}}RME
		case 2:
			// {{{RME classifier 'Logical View::DetectarObstaculo' state ':TOP:AguardandoDadosSonares'
			switch( portIndex )
			{
			case 0:
				switch( signalIndex )
				{
				case 1:
					return;
				default:
					break;
				}
				break;
			default:
				break;
			}
			break;
			// }}}RME
		case 3:
			// {{{RME classifier 'Logical View::DetectarObstaculo' state ':TOP:CalculandoTrajetoria'
			switch( portIndex )
			{
			case 0:
				switch( signalIndex )
				{
				case 1:
					return;
				default:
					break;
				}
				break;
			default:
				break;
			}
			break;
			// }}}RME
		case 4:
			// {{{RME classifier 'Logical View::DetectarObstaculo' state ':TOP:DesviandoObstaculo'
			switch( portIndex )
			{
			case 0:
				switch( signalIndex )
				{
				case 1:
					return;
				default:
					break;
				}
				break;
			default:
				break;
			}
			break;
			// }}}RME
		default:
			unexpectedState();
			return;
		}
}

const RTActor_class * DetectarObstaculo_Actor::getActorData( void ) const
{
	return &DetectarObstaculo_Actor::rtg_class;
}

const RTActor_class DetectarObstaculo_Actor::rtg_class =
{
	(const RTActor_class *)0
  , rtg_state_names
  , 4
  , DetectarObstaculo_Actor::rtg_parent_state
  , &DetectarObstaculo
  , 0
  , (const RTComponentDescriptor *)0
  , 0
  , (const RTPortDescriptor *)0
  , 0
  , (const RTLocalBindingDescriptor *)0
  , 0
  , (const RTFieldDescriptor *)0
};

const RTStateId DetectarObstaculo_Actor::rtg_parent_state[] =
{
	0
  , 1
  , 1
  , 1
};

#undef SUPER

// {{{RME classifier 'Logical View::DetectarObstaculo' tool 'OT::Cpp' property 'ImplementationEnding'
// {{{USR tool 'OT::Cpp' property 'ImplementationEnding'
// }}}USR
// }}}RME

// }}}RME
