telephonyserverplugins/multimodetsy/hayes/SCHAT.H
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Send/Expect Algorithms
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll 
       
    21 */
       
    22 
       
    23 #ifndef __SCHAT_H__
       
    24 #define __SCHAT_H__
       
    25 
       
    26 #include <e32base.h>
       
    27 /**
       
    28 @internalComponent
       
    29 */
       
    30 const TInt KChatBufferSize = 400; //increased from 200 to stop WrapCnt overrunning due to concatenated messages!!
       
    31 
       
    32 class CCommChatString;
       
    33 class MCommChatNotify
       
    34 /**
       
    35 @internalComponent
       
    36 */
       
    37 	{
       
    38 public:
       
    39 	virtual void ChatStringMatchL(CCommChatString* aCs)=0;
       
    40 	virtual void ChatTimeout()=0;
       
    41 	};
       
    42 
       
    43 class CCommChatter : public CTimer
       
    44 /**
       
    45 @internalComponent
       
    46 */
       
    47 	{
       
    48 public:
       
    49 	CCommChatter(MCommChatNotify* aNotify, TInt aPriority);
       
    50 	virtual ~CCommChatter();
       
    51 	void CreateL(TInt aBufferSize);
       
    52 	void AddCharL(TText8 aChar);
       
    53 	CCommChatString* AddStringL(const TDesC8& aString, TBool aPartLine);
       
    54 	void RemoveString(CCommChatString* aString);
       
    55 	TPtrC8 Buffer() const;
       
    56 	TPtrC8 CurrentLine() const;
       
    57 	void ClearBuffer();
       
    58 	void ClearCurrentLine();
       
    59 	void StartTimer(const TTimeIntervalMicroSeconds32 aTimeout);
       
    60 	void StopTimer();
       
    61 	void DeleteAllAndStop();
       
    62 protected:
       
    63 	virtual void RunL();
       
    64 protected:
       
    65 	MCommChatNotify* iNotify;
       
    66 	TDblQue<CCommChatString> iList;
       
    67 	TText8* iBuffer;
       
    68 	TText8* iBufferEnd;
       
    69 	TText8* iLastChar;			// Last character added
       
    70 	TText8* iLineStart;			// Start of \r\n delimited line
       
    71 	TBool iInDelimiter;
       
    72 	TInt iPartLineMatchers;		// count of CCommChatStrings which need partial line matches
       
    73 	};
       
    74 
       
    75 class CCommChatString : public CBase
       
    76 /**
       
    77 @internalComponent
       
    78 */
       
    79 	{
       
    80 public:
       
    81 	static CCommChatString* NewL(const TDesC8& aDes, TBool aIsPartialLine);
       
    82 	CCommChatString();
       
    83 	virtual ~CCommChatString();
       
    84 	void CreateL(const TDesC8& aDes, TBool aIsPartialLine);
       
    85 	inline const TPtrC8& Des() const {return iMatch;};
       
    86 protected:
       
    87 	TBool iIsPartialLine;
       
    88 	TPtrC8 iMatch;
       
    89 private:
       
    90 	friend class CCommChatter;
       
    91 	TDblQueLink iLink;
       
    92 	};
       
    93 
       
    94 #endif