simpleengine/engine/inc/simpleclient.h
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    SIMPLE Engine client base class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef simpleclient_H
       
    22 #define simpleclient_H
       
    23 
       
    24 #include <e32std.h>
       
    25 #include "simplecommon.h"
       
    26 #include "msimpleconnection.h"
       
    27 #include "msimpleowncallback.h"
       
    28 #include "msimpleenginerequest.h"
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CSimpleEngineRequest;
       
    32 class MSimpleWatcherObserver;
       
    33 class MSimpleConnectionObserver;
       
    34 
       
    35 /**
       
    36  *  CSimpleClient
       
    37  *
       
    38  *  SIMPLE Engine client base class.
       
    39  *
       
    40  *  @lib simpleengine
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 
       
    44 class CSimpleClient : public CBase, public MSimpleOwnCallback
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Destructor.
       
    51      */
       
    52     virtual ~CSimpleClient();
       
    53 
       
    54 
       
    55 // from base class MSimpleOwnCallback
       
    56 
       
    57 
       
    58     /**
       
    59      * Complete the open client request
       
    60      * @since S60 3.2
       
    61      * @param aOpId operation id
       
    62      * @param aStatus result status
       
    63      * @param aReq request
       
    64      */
       
    65     void virtual Complete( TInt aOpId, TInt aStatus, MSimpleEngineRequest& aReq ) = 0;
       
    66 
       
    67 protected:
       
    68 
       
    69     void IncreaseOpId( );
       
    70 
       
    71     /**
       
    72      * Delete pending requests
       
    73      */
       
    74     void DeleteRequests();
       
    75 
       
    76     /**
       
    77      * Search a specifi request
       
    78      * @param aOpID operation if to be matched
       
    79      * @return request or NULL if a request not found
       
    80      */
       
    81     CSimpleEngineRequest* SearchRequests( TInt aOpId );
       
    82 
       
    83     /**
       
    84      * Two-phase constructor
       
    85      */
       
    86     void BaseConstructL( );
       
    87 
       
    88     /**
       
    89      * constructor
       
    90      * @param aConn connection
       
    91      */
       
    92     CSimpleClient(
       
    93         MSimpleConnection& aConn );
       
    94 
       
    95     /**
       
    96      * Send a request to engine DLL
       
    97      * @param aReq request
       
    98      */
       
    99     void SendReqL( MSimpleEngineRequest& aReq );
       
   100 
       
   101     /**
       
   102      * Reason code converter
       
   103      * @param aR request that contains a reason code from NOTIFY
       
   104      * @return reason code
       
   105      */
       
   106     TInt ResponseReason(
       
   107         MSimpleEngineRequest& aR );
       
   108 
       
   109     /**
       
   110      * SIP Status accessor
       
   111      * Get the status of the last completed request.
       
   112      * @return SIP status, 0 if not available
       
   113      */
       
   114     TUint DoSIPStatus( );
       
   115 
       
   116     /**
       
   117      * SIP retry-fater value accessor
       
   118      * Get the status of the last completed request.
       
   119      * @return SIP retry-after value, 0 if not available
       
   120      */
       
   121     TUint DoRetryAfter( );
       
   122 
       
   123     /**
       
   124      * SIP Status getter
       
   125      * Get the SIP status of the specified request.
       
   126      * @param aOpId operation id
       
   127      */
       
   128     void GetSIPStatus( TInt aOpId );
       
   129 
       
   130 protected: // data
       
   131 
       
   132     /**
       
   133      * SIMPLE engine connection
       
   134      */
       
   135     MSimpleConnection& iConn;
       
   136 
       
   137     /**
       
   138      * next operation id
       
   139      */
       
   140     TInt iOpId;
       
   141 
       
   142     /**
       
   143      * SIP status of last operation completed
       
   144      */
       
   145     TUint iSipStatus;
       
   146     
       
   147     /**
       
   148      * SIP retry-after header
       
   149      */
       
   150     TInt iRetryAfterTime;    
       
   151 
       
   152     /**
       
   153      * Buffer for client requests
       
   154      */
       
   155     TDblQue<CSimpleEngineRequest> iRequestList;
       
   156 
       
   157     /**
       
   158      * Last request sent
       
   159      */
       
   160     MSimpleEngineRequest::TSimpleRequest iRequest;
       
   161 
       
   162     /**
       
   163      * Pointer to stack variable to detect the deletion of the heap
       
   164      * instance. This case takes place if a client
       
   165      * calls destructor in callback method.
       
   166      * Own.
       
   167      */
       
   168     TBool*                  iDestroyedPtr;
       
   169 
       
   170 private:    // data
       
   171 
       
   172     /**
       
   173      * Lower limit of opid
       
   174      */
       
   175     TInt iLimitLowerValue;
       
   176 
       
   177     /**
       
   178      * Upper limit of opid
       
   179      */
       
   180     TInt iLimitUpperValue;
       
   181 
       
   182     };
       
   183 
       
   184 #endif
       
   185 
       
   186 // End of File