wvuing/wvuiada/Src/CCAImpsImClient.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 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:  Implements instant messaging services interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CCAImpsImClient.h"
       
    22 #include	"TCAInterfaceSignaller.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // CCAImpsImClient::CCAImpsImClient
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CCAImpsImClient::CCAImpsImClient( RImpsEng& aImpsEng )
       
    33         : iImpsEng( aImpsEng )
       
    34     {
       
    35     }
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CCAImpsImClient::NewL
       
    39 // Two-phased constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CCAImpsImClient* CCAImpsImClient::NewL( RImpsEng& aImpsEng )
       
    43     {
       
    44     CCAImpsImClient* self = new( ELeave ) CCAImpsImClient( aImpsEng );
       
    45     return self;
       
    46     }
       
    47 
       
    48 
       
    49 // Destructor
       
    50 CCAImpsImClient::~CCAImpsImClient()
       
    51     {
       
    52     }
       
    53 
       
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 // CCAImpsImClient::InterfaceL
       
    57 // Returns registered WV Engine interface. Implements lazy initialization.
       
    58 // (other items were commented in a header).
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 RImpsImClient2* CCAImpsImClient::InterfaceL()
       
    62     {
       
    63     if ( iLazyInitialization )
       
    64         {
       
    65         // Connect to IMPS engine (server)
       
    66         TCAInterfaceSignaller::ConnectL();
       
    67 
       
    68         iClient.RegisterL( iImpsEng, iImHandler, iBlockingHandler, KNullDesC,
       
    69                            ETrue, iPriority );
       
    70         iLazyInitialization = EFalse;
       
    71         iRegistered = ETrue;
       
    72         if ( iErrorHandler )
       
    73             {
       
    74             iClient.RegisterErrorObserverL( *iErrorHandler );
       
    75             }
       
    76         if ( iStatusHandler )
       
    77             {
       
    78             iClient.RegisterStatusObserverL( iStatusHandler );
       
    79             }
       
    80         }
       
    81     return &iClient;
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CCAImpsImClient::RegisterL
       
    86 // Stores values for later registration. Implements lazy initialization.
       
    87 // (other items were commented in a header).
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 void CCAImpsImClient::RegisterL( MImpsImHandler2* aImpsObserver,
       
    91                                  MImpsBlockingHandler2* aBlockingHandler, TUid aApplicationId,
       
    92                                  TInt aPriority /* = 0 */ )
       
    93     {
       
    94     iPriority = aPriority;
       
    95     iApplicationId = aApplicationId;
       
    96     iImHandler = aImpsObserver;
       
    97     iBlockingHandler = aBlockingHandler;
       
    98     iLazyInitialization = ETrue;
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CCAImpsImClient::Unregister
       
   103 // Unregisters if registered. Clears member variables.
       
   104 // (other items were commented in a header).
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CCAImpsImClient::Unregister()
       
   108     {
       
   109     if ( iRegistered )
       
   110         {
       
   111         iClient.Unregister();
       
   112         }
       
   113     iLazyInitialization = ETrue;
       
   114     iRegistered = EFalse;
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CCAImpsImClient::GetServicesL
       
   119 // Forwards the call to WV Engine.
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void CCAImpsImClient::GetServicesL( TImpsServices& aServices )
       
   124     {
       
   125     InterfaceL()->GetServicesL( aServices );
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // CCAImpsImClient::SendTextMessageL
       
   130 // Forwards the call to WV Engine.
       
   131 // (other items were commented in a header).
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 TInt CCAImpsImClient::SendTextMessageL( const TDesC* aSenderSn,
       
   135                                         const MDesCArray* aUserIds,
       
   136                                         const TDesC* aGroupId,
       
   137                                         const MDesCArray* aScreenNames,
       
   138                                         const TDesC& aContent,
       
   139                                         TBool aDeliveryReportWanted )
       
   140     {
       
   141     return InterfaceL()->SendTextMessageL(  aSenderSn,
       
   142                                             aUserIds,
       
   143                                             aGroupId,
       
   144                                             aScreenNames,
       
   145                                             aContent,
       
   146                                             aDeliveryReportWanted );
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CCAImpsImClient::SendContentMessageL
       
   151 // Forwards the call to WV Engine.
       
   152 // (other items were commented in a header).
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TInt CCAImpsImClient::SendContentMessageL( const TDesC* aSenderSn,
       
   156                                            const MDesCArray* aUserIds,
       
   157                                            const TDesC* aGroupId,
       
   158                                            const MDesCArray* aScreenNames,
       
   159                                            const TDesC& aContentType,
       
   160                                            const TDesC8& aContent,
       
   161                                            TBool aDeliveryReportWanted )
       
   162     {
       
   163     return InterfaceL()->SendContentMessageL(  aSenderSn,
       
   164                                                aUserIds,
       
   165                                                aGroupId,
       
   166                                                aScreenNames,
       
   167                                                aContentType,
       
   168                                                aContent,
       
   169                                                aDeliveryReportWanted );
       
   170     }
       
   171 // -----------------------------------------------------------------------------
       
   172 // CCAImpsImClient::BlockEntityRequestL
       
   173 // Forwards the call to WV Engine.
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 TInt CCAImpsImClient::BlockEntityRequestL( const CDesCArray* aBlockEntity,
       
   178                                            const CDesCArray* aUnBlockEntity,
       
   179                                            TBool aBlockedListInUse,
       
   180                                            const CDesCArray* aGrantedEntityList,
       
   181                                            const CDesCArray* aUnGrantEntity,
       
   182                                            TBool aGrantedListInUse )
       
   183     {
       
   184     return InterfaceL()->BlockEntityRequestL( aBlockEntity,
       
   185                                               aUnBlockEntity,
       
   186                                               aBlockedListInUse,
       
   187                                               aGrantedEntityList,
       
   188                                               aUnGrantEntity,
       
   189                                               aGrantedListInUse );
       
   190     }
       
   191 
       
   192 // -----------------------------------------------------------------------------
       
   193 // CCAImpsImClient::GetBlockedListRequestL
       
   194 // Forwards the call to WV Engine.
       
   195 // (other items were commented in a header).
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 TInt CCAImpsImClient::GetBlockedListRequestL()
       
   199     {
       
   200     return InterfaceL()->GetBlockedListRequestL();
       
   201     }
       
   202 
       
   203 // -----------------------------------------------------------------------------
       
   204 // CCAImpsImClient::RegisterErrorObserverL
       
   205 // Calls WV Engine if registered.
       
   206 // (other items were commented in a header).
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 void CCAImpsImClient::RegisterErrorObserverL( MImpsErrorHandler2 &aObs )
       
   210     {
       
   211     iErrorHandler = &aObs;
       
   212     if ( iRegistered )
       
   213         {
       
   214         InterfaceL()->RegisterErrorObserverL( *iErrorHandler );
       
   215         }
       
   216     }
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // CCAImpsImClient::RegisterStatusObserverL
       
   220 // Calls WV Engine if registered.
       
   221 // (other items were commented in a header).
       
   222 // -----------------------------------------------------------------------------
       
   223 //
       
   224 void CCAImpsImClient::RegisterStatusObserverL( MImpsStatusHandler2* aObs )
       
   225     {
       
   226     iStatusHandler = aObs;
       
   227     if ( iRegistered )
       
   228         {
       
   229         InterfaceL()->RegisterStatusObserverL( iStatusHandler );
       
   230         }
       
   231     }
       
   232 
       
   233 // -----------------------------------------------------------------------------
       
   234 // CCAImpsImClient::UnregisterErrorObserverL
       
   235 // Calls WV Engine always.
       
   236 // (other items were commented in a header).
       
   237 // -----------------------------------------------------------------------------
       
   238 //
       
   239 void CCAImpsImClient::UnregisterErrorObserverL()
       
   240     {
       
   241     iClient.UnregisterErrorObserverL();
       
   242     }
       
   243 
       
   244 // -----------------------------------------------------------------------------
       
   245 // CCAImpsImClient::MaxTransactionContentLengthL
       
   246 // Calls WV Engine always.
       
   247 // (other items were commented in a header).
       
   248 // -----------------------------------------------------------------------------
       
   249 //
       
   250 TInt CCAImpsImClient::MaxTransactionContentLengthL( )
       
   251     {
       
   252     return iClient.MaxTransactionContentLengthL();
       
   253     }
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CCAImpsImClient::UnregisterStatusObserverL
       
   257 // Calls WV Engine always.
       
   258 // (other items were commented in a header).
       
   259 // -----------------------------------------------------------------------------
       
   260 //
       
   261 void CCAImpsImClient::UnregisterStatusObserverL()
       
   262     {
       
   263     iClient.UnregisterStatusObserverL();
       
   264     }
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // CCAImpsImClient::StatusHandler
       
   268 // Returns current status handler pointer.
       
   269 // (other items were commented in a header).
       
   270 // -----------------------------------------------------------------------------
       
   271 //
       
   272 MImpsStatusHandler2* CCAImpsImClient::StatusHandler() const
       
   273     {
       
   274     return iStatusHandler;
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CCAImpsImClient::ErrorHandler
       
   279 // Returns current error handler pointer.
       
   280 // (other items were commented in a header).
       
   281 // -----------------------------------------------------------------------------
       
   282 //
       
   283 MImpsErrorHandler2* CCAImpsImClient::ErrorHandler() const
       
   284     {
       
   285     return iErrorHandler;
       
   286     }
       
   287 
       
   288 //  End of File