ElmoMC Multi-Axis Motion Controller-Maestro User Manual
Page 130

Parsing of Maestro’s sample response:
CString Input;
// Maestro response string
…
//1 - new line removing
int n = Input.Find( "\r\n" );
while( n != -1 )
{
if( n == 0 )
{
Input = Input.Right( Input.GetLength() - 2 );
}
else
{
CString left = Input.Left( n );
CString right = Input.Right( Input.GetLength() - n - 2 );
Input = left + right;
}
n = Input.Find( "\r\n" );
}
//2 - prompt ‘>’ removing
Input = Input.Left( Input.GetLength() - 1 );
if(bCheckEcho)
{
//3 - new line removing
CString output = Output;
output.TrimRight('\r');
int n = Input.Find( output );
if( n != 0 ) return FALSE;
// ECHO is invalid
//4 - echo removing
Input = Input.Right( Input.GetLength() - output.GetLength() );
}
…
return TRUE;
Maestro
Software Manual
RS-232 Protocol Specification
MAN-MASSW (Ver. Q)
7-2