mmsharing/mmshavailability/inc/musavacapabilityquerybase.h
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2005-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:  Sent capability query (OPTIONS)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMUSAVACAPABILITYQUERYBASE_H
       
    20 #define CMUSAVACAPABILITYQUERYBASE_H
       
    21 
       
    22 
       
    23 #include <e32base.h>    // CBase
       
    24 
       
    25 #ifdef CAPABILITY_UNIT_TESTING
       
    26 #include "capabilitytestdefs.h"
       
    27 #else
       
    28 #define CAPABILITY_UT_DEFINITIONS
       
    29 #endif
       
    30 
       
    31 
       
    32 
       
    33 class CMusAvaCapability;
       
    34 class CSIPConnection;
       
    35 class CSIPProfile;
       
    36 class CSdpDocument;
       
    37 
       
    38 class CSIPClientTransaction;
       
    39 class CMusAvaTerminal;
       
    40 class CSIPHeaderBase;
       
    41 class CUri8;
       
    42 
       
    43 const TInt KCapabilityQueryNotReady = 0;
       
    44 const TInt KCapabilityCapabilitesReady = 1;
       
    45 const TInt KCapabilityCapabilitesNotFound = 2;
       
    46 const TInt KCapabilityCapabilitiesForbidden = 3;
       
    47 
       
    48 
       
    49 /**
       
    50  * Sent capability query (OPTIONS)
       
    51  *
       
    52  * @lib AlwaysOnlineSwisPlugin.dll
       
    53  */
       
    54 class CMusAvaCapabilityQueryBase : public CBase
       
    55     {
       
    56 
       
    57 public: 
       
    58 
       
    59     enum TState
       
    60         {
       
    61         ECapabilityQueryCreated,
       
    62         ECapabilityQueryPrepared,
       
    63         ECapabilityQueryExecuting,
       
    64         ECapabilityQueryCompleted
       
    65         };
       
    66 
       
    67 public: // constructors and destructor
       
    68 
       
    69     virtual ~CMusAvaCapabilityQueryBase();
       
    70 
       
    71 
       
    72 protected: // constructors
       
    73 
       
    74     CMusAvaCapabilityQueryBase( CMusAvaCapability& aCapability,
       
    75                               CSIPConnection& aSIPConnection,
       
    76                               CSIPProfile& aProfile );
       
    77 
       
    78 
       
    79     void ConstructL( const TDesC& aSipAddress );
       
    80     
       
    81 public: // new functions
       
    82 
       
    83     /**
       
    84      * Executes OPTIONS query
       
    85      *
       
    86      */
       
    87     virtual void ExecuteL();
       
    88 
       
    89     /**
       
    90      * Complets the query
       
    91      *
       
    92      * @param aResponse a response to query as SIP client transaction
       
    93      */
       
    94     void CompletedL( const CSIPClientTransaction& aResponse );
       
    95 
       
    96     /**
       
    97      * Cancels query, if transaction is created by this query
       
    98      *
       
    99      * @param aResponse a response to query as SIP client transaction
       
   100      */
       
   101     void Canceled( const CSIPClientTransaction& aTransaction );
       
   102 
       
   103     /**
       
   104      * Returns associated terminal
       
   105      *
       
   106      * @return returns associated terminal
       
   107      */
       
   108     CMusAvaTerminal& Terminal();
       
   109 
       
   110     /**
       
   111      * Returns the sdp content.
       
   112      *     
       
   113      */
       
   114     HBufC8* ContentLC();
       
   115 
       
   116     
       
   117     
       
   118 public: // new functions
       
   119 
       
   120     /**
       
   121      * Returns state of query
       
   122      *
       
   123      * @return state of query
       
   124      */
       
   125     TState State() const;
       
   126     
       
   127     /**
       
   128      * Returns result of query
       
   129      *
       
   130      * @return result of query
       
   131      */
       
   132     TInt Result() const;
       
   133     
       
   134     
       
   135 protected: // abstract functions
       
   136 
       
   137     /**
       
   138      * Prepares query
       
   139      *
       
   140      * @param aRequestHeaders headers container for request
       
   141      */
       
   142     virtual void Prepare( RPointerArray<CSIPHeaderBase>& aRequestHeaders ) = 0;
       
   143     
       
   144     /**
       
   145      * Complets the query
       
   146      *
       
   147      * @param aResponse a response to query as SIP client transaction
       
   148      */
       
   149     virtual void DoCompletedL( const CSIPClientTransaction& aResponse ) = 0;
       
   150 
       
   151 
       
   152 protected: // new functions
       
   153 
       
   154     /**
       
   155      * Returns capablity, which is beed queried
       
   156      *
       
   157      * @return capablity
       
   158      */
       
   159     const CMusAvaCapability& Capability() const;
       
   160     
       
   161     /**
       
   162      * Sets state 
       
   163      *
       
   164      * @param aState new state
       
   165      */
       
   166     void SetState( TState aState );
       
   167     
       
   168     /**
       
   169      * Sets result
       
   170      *
       
   171      * @param aResult the result
       
   172      */
       
   173     void SetResult( TInt aResult );
       
   174    
       
   175     /**
       
   176      * Adds Contact header to request's user headers
       
   177      *
       
   178      * @param aRequestHeaders request's user headers
       
   179      */
       
   180     virtual void AddContactHeaderL( RPointerArray<CSIPHeaderBase>& aRequestHeaders );
       
   181 
       
   182     /**
       
   183      * Resets and destroys transaction
       
   184      */
       
   185     void ResetAndDestroyTrx();
       
   186     
       
   187     /**
       
   188      * Returns local address based on profile
       
   189      *
       
   190      * @return local adderss
       
   191      */
       
   192     const CUri8& LocalAddress() const;
       
   193 
       
   194     /**
       
   195      * Some Multimediasharing specific sdp contents are added.
       
   196      *     
       
   197      */
       
   198     void OtherSDPHeadersL( CSdpDocument& aResponseContent );
       
   199     
       
   200 
       
   201 private: // NOT own data
       
   202 
       
   203     CMusAvaCapability& iCapability;
       
   204     CSIPConnection& iSIPConnection;
       
   205     CSIPProfile& iProfile;
       
   206 
       
   207     TState iState;
       
   208     TInt iResult;
       
   209 
       
   210     CMusAvaTerminal* iTerminal;
       
   211     
       
   212 private: // own data
       
   213     
       
   214     CUri8* iRegisteredContact;
       
   215     CUri8* iOriginator;
       
   216     CSIPClientTransaction* iTrx;
       
   217     
       
   218 //for unit testing
       
   219     CAPABILITY_UT_DEFINITIONS
       
   220     
       
   221     };
       
   222 
       
   223 
       
   224 #endif // CMUSAVACAPABILITYQUERYBASE_H