wvuing/wvuipresence/src/TCARequestQueue.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Request queue handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "TCARequestQueue.h"
       
    22 #include    "ChatDebugPrint.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // TCARequestQueue::WaitForResponse
       
    28 // ?implementation_description
       
    29 // (other items were commented in a header).
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 void TCARequestQueue::WaitForResponseL( TWaitCategory aCategory )
       
    33     {
       
    34     CHAT_DP_TXT( "TCARequestQueue, wait requested" );
       
    35     CActiveSchedulerWait* wait = Wait( aCategory );
       
    36 
       
    37     if ( wait )
       
    38         {
       
    39         if ( wait->IsStarted() )
       
    40             {
       
    41             CHAT_DP_TXT(
       
    42                 "TCARequestQueue, given category wait is already active!" );
       
    43             // Server can handle only 1 certain request per time
       
    44             User::Leave( KErrServerBusy );
       
    45             }
       
    46 
       
    47         wait->Start();
       
    48         }
       
    49     else
       
    50         {
       
    51         // If given category was not supported, then leave
       
    52         User::Leave( KErrArgument );
       
    53         }
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // TCARequestQueue::ResponseReceived
       
    58 // ?implementation_description
       
    59 // (other items were commented in a header).
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void TCARequestQueue::ResponseReceived( TWaitCategory aCategory )
       
    63     {
       
    64     CHAT_DP_TXT( "TCARequestQueue, wait stop requested" );
       
    65 
       
    66     CActiveSchedulerWait* wait = Wait( aCategory );
       
    67     if ( wait )
       
    68         {
       
    69         if ( wait->IsStarted() )
       
    70             {
       
    71             wait->AsyncStop();
       
    72             }
       
    73         }
       
    74     }
       
    75 
       
    76 CActiveSchedulerWait* TCARequestQueue::Wait( TWaitCategory aCategory )
       
    77     {
       
    78     switch ( aCategory )
       
    79         {
       
    80         case EFetcherWait:
       
    81             {
       
    82             CHAT_DP_TXT( "TCARequestQueue mapping wait operation \
       
    83              to EFetcherWait" );
       
    84             return &iFetcherWait; // Does not need break because return
       
    85             }
       
    86         case EPublisherWait:
       
    87             {
       
    88             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
    89              EPublisherWait" );
       
    90             return &iPublisherWait; // Does not need break because return
       
    91             }
       
    92         case EContactListUpdater:
       
    93             {
       
    94             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
    95              EContactListUpdater" );
       
    96 
       
    97             // Does not need break because return
       
    98             return &iContactListUpdaterWait;
       
    99             }
       
   100         case EAttributeListUpdater:
       
   101             {
       
   102             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
   103              EAttributeListUpdater" );
       
   104             // Does not need break because return
       
   105             return &iAttributeListUpdaterWait;
       
   106             }
       
   107         case EDecodeAttrWait:
       
   108             {
       
   109             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
   110                       EDecodeAttrWait" );
       
   111             return &iDecodeAttrWait; // Does not need break because return
       
   112             }
       
   113         case EAppendContactsWait:
       
   114             {
       
   115             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
   116                       EAppendContactsWait" );
       
   117             return &iAppendContactsWait; // Does not need break because return
       
   118             }
       
   119         case EReactiveAuthWait:
       
   120             {
       
   121             CHAT_DP_TXT( "TCARequestQueue mapping wait operation to \
       
   122                       EReactiveAuthWait" );
       
   123             return &iReactiveAuthWait; // Does not need break because return
       
   124             }
       
   125         default:
       
   126             {
       
   127             CHAT_DP_TXT( "TCARequestQueue UNSUPPORTED wait category!!!" );
       
   128             return NULL; // Does not need break because return
       
   129             }
       
   130         }
       
   131     }
       
   132 
       
   133 //  End of File