TInt CIniFileParser::GetNextTokenAndCheck(TLex8& lex, TPtr8& tempPtr)
/*
Gets next token and ensures the token is simply not the EOF or a linefeed.
lex is the lexical string to get the next token from.
tempPtr points to the next token
Returns KErrGeneral if token is bad or if we've already read past the end.
*/
	{
	TUint8 ch;
	TInt len;

	if (lex.Eos())
		{
		return KErrGeneral;
		}
	
	tempPtr = lex.NextToken();

	len = tempPtr.Length();
	if (len == 0)
		{
		// lex has figured out what is left is just the EOF
		return KErrGeneral;
		}

	// this next part may be superfluous but we've had so much strife with
	// the parser thus far that for now we're leaving it in

	ch = tempPtr[0];
	if (ch == KCarriageReturn || ch == KLineFeed)
		{
		return KErrGeneral;
		}

	if (tempPtr.Length() < 2)
		{
		return KErrNone;
		}
	ch = tempPtr[1];
	if (ch == KCarriageReturn || ch == KLineFeed)
		{
		return KErrGeneral;
		}

	return KErrNone;
	}
// -----------------------------------------------------------------------------
// CEcmtPanPlugin::SendCurrentValues
// 
// -----------------------------------------------------------------------------
//
void CEcmtPanPlugin::SendCurrentValuesL( )
    {
#ifdef ECMT_RDEBUG
	RDebug::Print( _L( "EcmtPanPlugin::SendCurrentValuesL" ) );
#endif
    TBuf<KMaxWin32Path> buf;
    TBuf8<KMaxPanMsgLen> msg;
	TPtrC8 line;
	TLex8 lexer;
	
	/*
	* Handle bt.esk
	*/
    GetBtEskFilename( buf );
    
    REcmtFile btFile( buf );
    btFile.Read();
    if ( !btFile.IsGood() )
        {
        return;
        }

    line.Set( btFile.FindLine( KBtPort ) );
    if ( line.Length() == 0 )
        {
        return;
        }

    msg.Append( KBtCom );
    msg.Append( ' ' );

    lexer.Assign( line );
    lexer.SkipCharacters();
    msg.Append( lexer.NextToken() );
    msg.Append( ' ' );
    
    line.Set( btFile.FindLine( KHciDll ) );
    if ( line.Length() == 0 )
        {
        return;
        }

    msg.Append( KHci );
    msg.Append( ' ' );
    lexer.Assign( line );
    lexer.SkipCharacters();
    TPtrC8 dll( lexer.NextToken() );
    if ( dll.CompareF( KHciDllBcsp ) == 0 )
        {
        msg.Append( '0' );
        }
    else if ( dll.CompareF( KHciDllH4 ) == 0 )
        {
        msg.Append( '1' );
        }
    else if ( dll.CompareF( KHciDllUsb ) == 0 )
        {
        msg.Append( '2' );
        }
    else
        {
        msg.Append( '-1' );
        }

	/*
	* Handle irda.esk
	*/
    GetIrdaEskFilename( buf );
    
    REcmtFile irdaFile( buf );
    irdaFile.Read();
    if ( !irdaFile.IsGood() )
        {
        return;
        }

    line.Set( irdaFile.FindLine( KIrdaPort ) );
    if ( line.Length() == 0 )
        {
        return;
        }

    msg.Append( ' ' );
    msg.Append( KIrdaCom );
    msg.Append( ' ' );

    lexer.Assign( line );
    lexer.SkipCharacters();
    msg.Append( lexer.NextToken() );

	/*
	* Send values
	*/
    CEcmtMessageEvent* m = iMessaging->NewMessageEvent( iTargetUid, msg );
    if ( m )
        {
#ifdef ECMT_RDEBUG
		RDebug::Print( _L( "EcmtPanPlugin::SendCurrentValuesL: Sending a message" ) );
#endif
        iMessageSender->SendMessage( m );
        }
    }