Пример #1
0
int FocalPoint::SetCommand(std::string command)
{
   std::string sendCommand = g_RemoteCommand;
   if (command == g_Local)
      sendCommand = g_LocalCommand;

   std::string answer;
   int ret = QueryCommand(sendCommand.c_str(), answer);
   if (ret != DEVICE_OK)
      return ret;

   commandState_ = command;

   return DEVICE_OK;
}
Пример #2
0
int FocalPoint::SetContinuousFocusing(bool state)
{
   std::string command = g_DSPengage;
   if (!state)
      command = g_DSPdisengage;

   std::string answer;
   int ret = QueryCommand(command.c_str(), answer);
   if (ret != DEVICE_OK)
      return ret;

   if (state)
      focusState_ = g_On;
   else
      focusState_ = g_Off;

   return DEVICE_OK;
}
Пример #3
0
int FocalPoint::SetLaser(bool state)
{
   std::string command = g_LaserOn;
   if (!state)
      command = g_LaserOff;

   std::string answer;
   int ret = QueryCommand(command.c_str(), answer);
   if (ret != DEVICE_OK)
      return ret;

   if (state)
      laserState_ = g_On;
   else
      laserState_ = g_Off;

   return DEVICE_OK;
}
Пример #4
0
void clConsole::SendCommand( const LString& CMDName )
{
	guard( "%s", CMDName.c_str() );

	FSendCommandResult.assign( "" );

	if ( CMDName.size() == 0 )
	{
		return;
	}

	bool IsScript = ( LStr::GetUpper( LStr::GetToken( CMDName, 1 ) ) == "RS" );

	// split command
	size_t CommandsSeparator = FindCommandsSeparator( CMDName );

	LString ThisCMDString = CMDName;
	LString RestCMDString( "" );

	if ( !IsScript )
	{
		if ( CommandsSeparator )
		{
			ThisCMDString = CMDName.substr( 0, CommandsSeparator );
			RestCMDString = CMDName.substr( CommandsSeparator,
			                                CMDName.length() - CommandsSeparator );

			if ( RestCMDString.length() > 0 )
			{
				LStr::pop_front( &RestCMDString );
			}
		}
	}

	// extract command name and parameters
	LString ThisCMDName  = LStr::GetToken( ThisCMDString, 1 );
	LString ThisCMDParam = ThisCMDString.substr( ThisCMDName.length(),
	                                             ThisCMDString.length() - ThisCMDName.length() );

	if ( ThisCMDParam.length() > 0 )
	{
		LStr::pop_front( &ThisCMDParam );
	}

	LStr::ToUpper( &ThisCMDName );

	if ( IsScript )
	{
		// execute script and return
		ExecuteStatement( ThisCMDParam );

		return;
	}

	if ( ThisCMDName.find( "WAIT" ) == 0 )
	{
		// Leave the rest of the command until the next frame
		if ( CommandsSeparator )
		{
			QueryCommand( RestCMDString );
		}

		return;
	}
	else
	{
		clCommandsList::const_iterator i = FCommandsList.find( ThisCMDName );

		if ( i != FCommandsList.end() )
		{
			( i->second ).Exec( clFileSystem::ReplaceEnvVars( ThisCMDParam ) );
		}
		else
		{
			clAliasesList::const_iterator j = FAliasesList.find( ThisCMDName );

			if ( j != FAliasesList.end() )
			{
				QueryCommand( j->second );
			}
			else
			{
				DisplayError( "Unknown command: " + ThisCMDName );
			}
		}
	}

	if ( CommandsSeparator )
	{
		SendCommand( RestCMDString );
	}

	unguard();
}