sipproviderplugins/sipprovider/sipstatemachine/inc/SipStateMachineBase.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2005-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 // CStateMachine definition file
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef SIP_STATE_MACHINE_BASE_H
       
    24 #define SIP_STATE_MACHINE_BASE_H
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 class CStateMachine : public CActive
       
    30    {
       
    31    public:
       
    32       IMPORT_C ~CStateMachine();
       
    33 
       
    34       TInt LastError() const;
       
    35       void SetLastError( TInt aLastError );
       
    36       void SetClientStatus( TRequestStatus* aClientStatus );
       
    37       TRequestStatus* ClientStatus() const;
       
    38       void SetActiveEvent( CAsynchEvent* aEvent );
       
    39       void SetErrorEvent( CAsynchEvent* aEvent );
       
    40       void SetSuspendRequest( TBool aSuspendRequest );
       
    41       TBool SuspendRequest() const;
       
    42 
       
    43       void UpdateHistory( TInt aUpdate );
       
    44       TInt History() const;
       
    45 
       
    46       void RegisterNotify( MStateMachineNotify* aStateMachineNotify );
       
    47       void DeRegisterNotify( MStateMachineNotify* aStateMachineNotify );
       
    48    
       
    49       IMPORT_C void Start( TRequestStatus* aClientStatus, CAsynchEvent* aErrorEvent, MStateMachineNotify* aStateMachineNotify
       
    50          /*the object is NOT taking ownership of the params*/ );
       
    51       //CActive::Cancel method should not be used
       
    52       IMPORT_C void Cancel( TInt aLastError );
       
    53 
       
    54       IMPORT_C HBufC8* ReAllocL( TInt aNewLength );
       
    55       HBufC8* Fragment() const;
       
    56 
       
    57    protected:
       
    58       IMPORT_C CStateMachine();
       
    59 
       
    60 	   IMPORT_C virtual void DoCancel();
       
    61 	   IMPORT_C virtual void RunL();
       
    62 	   IMPORT_C virtual TInt RunError(TInt aError);
       
    63 
       
    64       IMPORT_C void OnError();
       
    65       IMPORT_C virtual void OnCompletion();
       
    66 
       
    67    protected:
       
    68       CAsynchEvent* iActiveEvent; //referenced not owned
       
    69       CAsynchEvent* iErrorEvent; //referenced not owned
       
    70       TInt iHistory;
       
    71       TInt iLastError;
       
    72 
       
    73       TRequestStatus* iClientStatus; //optional
       
    74       HBufC8* iFragment; //shared data fragment buffer owned by this class
       
    75 
       
    76       MStateMachineNotify* iStateMachineNotify; //one at the time so far
       
    77       TBool iSuspendRequest : 1; //if ETrue causes the state machine to stop after completion of
       
    78       //ongoing asynch event (no client request will be completed but MStateMachineNotify::OnCompletion
       
    79       //will be called if installed)
       
    80    };
       
    81 
       
    82 
       
    83 #endif
       
    84