firmware/Temperature/src/Terminal.c
///////////////////////////////////////////////////////////////////////////////
/// \brief process the buffer data and extract the commands
///
///	\return TRUE success. FALSE no error
///
///	\todo update the document return state value. need to implement
///////////////////////////////////////////////////////////////////////////////
\brief process the buffer data and extract the commands
\return TRUE success. FALSE no error

\todo update the document return state value. need to implement
\ brief process the buffer data and extract the commands \ return TRUE success . FALSE no error \ todo update the document return state value . need to implement
int_fast8_t Terminal_Process(void)
{
	uint8_t SerialTempData = 0; 
	int_fast8_t Result = FALSE;
	Result = SerialPort2.GetByte(&SerialTempData);
	if ( TRUE != Result )
	{
		return Result;
	}
	SerialPort2.SendByte(SerialTempData);
	if ('\r' == SerialTempData)
	{
		if (NumberOfByteReceived)
		{
			if ( TRUE == ProcessData(&Buffer[0], NumberOfByteReceived, &ParameterList) )
			{
				if(  TRUE == RunCommand(&ParameterList) )
				{
					Result =  TRUE;
				}
			}
		}
		else
		{
			Result =  FALSE;
		}
		SerialPort2.SendString((uint8_t*)"\r\n> ");
	}
	else if ( (SerialTempData >= '0' && SerialTempData <= '9') ||
			(SerialTempData >= 'A' && SerialTempData <= 'Z') ||
			(SerialTempData >= 'a' && SerialTempData <= 'z') || ' ' == SerialTempData || '.' == SerialTempData)
	{
		if ( NumberOfByteReceived < TERMINAL_BUFFER_SIZE )
		{
			Buffer[NumberOfByteReceived] = SerialTempData;
			NumberOfByteReceived++;
			return FALSE;
		}
	}
	NumberOfByteReceived = 0;
	return Result;
}
int_fast8_t Terminal_Process ( void ) { uint8_t SerialTempData = 0 ; int_fast8_t Result = FALSE ; Result = SerialPort2 . GetByte ( & SerialTempData ) ; if ( TRUE != Result ) { return Result ; } SerialPort2 . SendByte ( SerialTempData ) ; if ( ' \r ' == SerialTempData ) { if ( NumberOfByteReceived ) { if ( TRUE == ProcessData ( & Buffer [ 0 ] , NumberOfByteReceived , & ParameterList ) ) { if ( TRUE == RunCommand ( & ParameterList ) ) { Result = TRUE ; } } } else { Result = FALSE ; } SerialPort2 . SendString ( ( uint8_t * ) " \r \n " ) ; } else if ( ( SerialTempData >= ' ' && SerialTempData <= ' ' ) || ( SerialTempData >= ' ' && SerialTempData <= ' ' ) || ( SerialTempData >= ' ' && SerialTempData <= ' ' ) || ' ' == SerialTempData || ' ' == SerialTempData ) { if ( NumberOfByteReceived < TERMINAL_BUFFER_SIZE ) { Buffer [ NumberOfByteReceived ] = SerialTempData ; NumberOfByteReceived ++ ; return FALSE ; } } NumberOfByteReceived = 0 ; return Result ; }
\brief process the buffer data and extract the commands
\return TRUE success.
\ brief process the buffer data and extract the commands \ return TRUE success .
// hold the new byte from the serial fifo // echo the user command // Send new line feed and prompt //SerialPort2.SendString((uint8_t*)"\r\n> "); /// \todo call the process data // reset buffer by reseting the counter