phonebookui/Phonebook2/UIServices/src/RPbk2UIService.cpp
branchRCL_3
changeset 63 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Phonebook 2 UI Service IPC client.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "RPbk2UIService.h"
       
    20 
       
    21 // Phonebook 2
       
    22 #include <Pbk2InternalUID.h>
       
    23 
       
    24 // --------------------------------------------------------------------------
       
    25 // RPbk2UIService::RPbk2UIService
       
    26 // --------------------------------------------------------------------------
       
    27 //
       
    28 RPbk2UIService::RPbk2UIService() :
       
    29         iConfigurationPackagePtr( NULL, 0 ),
       
    30         iDataPackagePtr( NULL, 0 ),
       
    31         iInstructionsPtr( NULL, 0 ),
       
    32         iResultArraySizePtr( NULL, 0 ),
       
    33         iArrayResultsPtr( NULL, 0 ),
       
    34         iCanceledPtr( NULL, 0 ),
       
    35         iExitCommandIdPtr( NULL, 0 ),
       
    36         iCountPtr( NULL, 0 ),
       
    37         iContactLinkPtr( NULL, 0 ),
       
    38         iResultFieldSizePtr( NULL, 0 ),
       
    39         iFieldResultsPtr( NULL, 0 )
       
    40     {
       
    41     }
       
    42 
       
    43 // --------------------------------------------------------------------------
       
    44 // RPbk2UIService::LaunchAssignL
       
    45 // --------------------------------------------------------------------------
       
    46 //
       
    47 void RPbk2UIService::LaunchAssignL
       
    48         ( TRequestStatus& aStatus,  HBufC8* aConfigurationPackage,
       
    49         HBufC8* aDataPackage, HBufC8* aAssignInstructions, TBool& aCanceled )
       
    50     {
       
    51     iConfigurationPackagePtr.Set( NULL, 0, 0 );
       
    52     if ( aConfigurationPackage )
       
    53         {
       
    54         iConfigurationPackagePtr.Set( aConfigurationPackage->Des() );
       
    55         }
       
    56 
       
    57     iDataPackagePtr.Set( NULL, 0, 0 );
       
    58     if ( aDataPackage )
       
    59         {
       
    60         iDataPackagePtr.Set( aDataPackage->Des() );
       
    61         }
       
    62 
       
    63     iInstructionsPtr.Set( NULL, 0, 0 );
       
    64     if ( aAssignInstructions )
       
    65         {
       
    66         iInstructionsPtr.Set( aAssignInstructions->Des() );
       
    67         }
       
    68 
       
    69     TPckg<TBool> canceled( aCanceled );
       
    70     iCanceledPtr.Set( canceled );
       
    71 
       
    72     SendReceive( EPbk2LaunchAssign,
       
    73         TIpcArgs( &iConfigurationPackagePtr, &iDataPackagePtr,
       
    74             &iInstructionsPtr, &iCanceledPtr ),
       
    75                 aStatus );
       
    76     }
       
    77 
       
    78 // --------------------------------------------------------------------------
       
    79 // RPbk2UIService::LaunchAttributeAssignL
       
    80 // --------------------------------------------------------------------------
       
    81 //
       
    82 void RPbk2UIService::LaunchAttributeAssignL
       
    83         ( TRequestStatus& aStatus, HBufC8* aConfigurationPackage,
       
    84           TPbk2AttributeAssignData& aAttributePackage,
       
    85           HBufC8* aAssignInstructions, TBool& aCanceled )
       
    86     {
       
    87     iConfigurationPackagePtr.Set( NULL, 0, 0 );
       
    88     if ( aConfigurationPackage )
       
    89         {
       
    90         iConfigurationPackagePtr.Set( aConfigurationPackage->Des() );
       
    91         }
       
    92 
       
    93     TPckg<TPbk2AttributeAssignData> attributePackage( aAttributePackage );
       
    94     iDataPackagePtr.Set( attributePackage );
       
    95 
       
    96     iInstructionsPtr.Set( NULL, 0, 0 );
       
    97     if ( aAssignInstructions )
       
    98         {
       
    99         iInstructionsPtr.Set( aAssignInstructions->Des() );
       
   100         }
       
   101 
       
   102     TPckg<TBool> canceled( aCanceled );
       
   103     iCanceledPtr.Set( canceled );
       
   104 
       
   105     SendReceive( EPbk2LaunchAttributeAssign,
       
   106         TIpcArgs( &iConfigurationPackagePtr, &iDataPackagePtr,
       
   107             &iInstructionsPtr, &iCanceledPtr ),
       
   108                 aStatus );
       
   109     }
       
   110 
       
   111 // --------------------------------------------------------------------------
       
   112 // RPbk2UIService::LaunchAttributeUnassignL
       
   113 // --------------------------------------------------------------------------
       
   114 //
       
   115 void RPbk2UIService::LaunchAttributeUnassignL
       
   116         ( TRequestStatus& aStatus, HBufC8* aConfigurationPackage,
       
   117           TPbk2AttributeAssignData aAttributePackage,
       
   118           HBufC8* aAssignInstructions, TBool& aCanceled )
       
   119     {
       
   120     iConfigurationPackagePtr.Set( NULL, 0, 0 );
       
   121     if ( aConfigurationPackage )
       
   122         {
       
   123         iConfigurationPackagePtr.Set( aConfigurationPackage->Des() );
       
   124         }
       
   125 
       
   126     TPckg<TPbk2AttributeAssignData> attributePackage( aAttributePackage );
       
   127     iDataPackagePtr.Set( attributePackage );
       
   128 
       
   129     iInstructionsPtr.Set( NULL, 0, 0 );
       
   130     if ( aAssignInstructions )
       
   131         {
       
   132         iInstructionsPtr.Set( aAssignInstructions->Des() );
       
   133         }
       
   134 
       
   135     TPckg<TBool> canceled( aCanceled );
       
   136     iCanceledPtr.Set( canceled );
       
   137 
       
   138     SendReceive( EPbk2LaunchAttributeUnassign,
       
   139         TIpcArgs( &iConfigurationPackagePtr, &iDataPackagePtr,
       
   140             &iInstructionsPtr, &iCanceledPtr ),
       
   141                 aStatus );
       
   142     }
       
   143 
       
   144 // --------------------------------------------------------------------------
       
   145 // RPbk2UIService::LaunchFetchL
       
   146 // --------------------------------------------------------------------------
       
   147 //
       
   148 void RPbk2UIService::LaunchFetchL
       
   149         ( TRequestStatus& aStatus,  HBufC8* aConfigurationPackage,
       
   150           HBufC8* aFetchInstructions, TBool& aCanceled )
       
   151     {
       
   152     iConfigurationPackagePtr.Set( NULL, 0, 0 );
       
   153     if ( aConfigurationPackage )
       
   154         {
       
   155         iConfigurationPackagePtr.Set( aConfigurationPackage->Des() );
       
   156         }
       
   157 
       
   158     iInstructionsPtr.Set( NULL, 0, 0 );
       
   159     if ( aFetchInstructions )
       
   160         {
       
   161         iInstructionsPtr.Set( aFetchInstructions->Des() );
       
   162         }
       
   163 
       
   164     TPckg<TBool> canceled( aCanceled );
       
   165     iCanceledPtr.Set( canceled );
       
   166 
       
   167     SendReceive( EPbk2LaunchFetch,
       
   168         TIpcArgs( &iConfigurationPackagePtr, &iInstructionsPtr,
       
   169             &iCanceledPtr ), aStatus );
       
   170     }
       
   171 
       
   172 // --------------------------------------------------------------------------
       
   173 // RPbk2UIService::CancelAssign
       
   174 // --------------------------------------------------------------------------
       
   175 //
       
   176 void RPbk2UIService::CancelAssign
       
   177         ( TBool& aCanceled )
       
   178     {
       
   179     TPckg<TBool> canceled( aCanceled );
       
   180     iCanceledPtr.Set( canceled );
       
   181 
       
   182     SendReceive( EPbk2CancelAssign, TIpcArgs( &iCanceledPtr ) );
       
   183     }
       
   184 
       
   185 // --------------------------------------------------------------------------
       
   186 // RPbk2UIService::CancelFetch
       
   187 // --------------------------------------------------------------------------
       
   188 //
       
   189 void RPbk2UIService::CancelFetch
       
   190         ( TBool& aCanceled )
       
   191     {
       
   192     TPckg<TBool> canceled( aCanceled );
       
   193     iCanceledPtr.Set( canceled );
       
   194 
       
   195     SendReceive( EPbk2CancelFetch, TIpcArgs( &iCanceledPtr ) );
       
   196     }
       
   197 
       
   198 // --------------------------------------------------------------------------
       
   199 // RPbk2UIService::GetResultsL
       
   200 // --------------------------------------------------------------------------
       
   201 //
       
   202 void RPbk2UIService::GetResultsL( HBufC8& aArrayResults, TInt& aExtraData,
       
   203         HBufC& aFieldResults )
       
   204     {
       
   205     iArrayResultsPtr.Set( aArrayResults.Des() );
       
   206     TPckg<TInt> extraData( aExtraData );
       
   207     iFieldResultsPtr.Set( aFieldResults.Des() );
       
   208     
       
   209     User::LeaveIfError( SendReceive( EPbk2GetResults,
       
   210         TIpcArgs( &iArrayResultsPtr, &extraData, &iFieldResultsPtr ) ) );
       
   211     }
       
   212 
       
   213 // --------------------------------------------------------------------------
       
   214 // RPbk2UIService:GetResultSizeL
       
   215 // --------------------------------------------------------------------------
       
   216 //
       
   217 void RPbk2UIService::GetResultSizeL( TInt& aArrayResultSize,
       
   218         TInt& aFieldResultSize )
       
   219     {
       
   220     TPckg<TInt> resultArraySize( aArrayResultSize );
       
   221     iResultArraySizePtr.Set( resultArraySize );
       
   222     
       
   223     TPckg<TInt> resultFieldSize( aFieldResultSize );
       
   224     iResultFieldSizePtr.Set( resultFieldSize );
       
   225     
       
   226     User::LeaveIfError( SendReceive( EPbk2GetResultSize,
       
   227         TIpcArgs( &iResultArraySizePtr, &iResultFieldSizePtr ) ) );
       
   228     }
       
   229 
       
   230 // --------------------------------------------------------------------------
       
   231 // RPbk2UIService::ExitRequestL
       
   232 // --------------------------------------------------------------------------
       
   233 //
       
   234 void RPbk2UIService::ExitRequestL
       
   235         ( TRequestStatus& aStatus, TInt& aExitCommandId )
       
   236     {
       
   237     TPckg<TInt> exitId( aExitCommandId );
       
   238     iExitCommandIdPtr.Set( exitId );
       
   239     SendReceive( EPbk2ExitRequest, TIpcArgs( &iExitCommandIdPtr ),
       
   240         aStatus );
       
   241     }
       
   242 
       
   243 // --------------------------------------------------------------------------
       
   244 // RPbk2UIService::CancelExitRequest
       
   245 // --------------------------------------------------------------------------
       
   246 //
       
   247 void RPbk2UIService::CancelExitRequest()
       
   248     {
       
   249     SendReceive( EPbk2CancelExitRequest );
       
   250     }
       
   251 
       
   252 // --------------------------------------------------------------------------
       
   253 // RPbk2UIService::ExitServiceL
       
   254 // --------------------------------------------------------------------------
       
   255 //
       
   256 void RPbk2UIService::ExitServiceL
       
   257         ( TBool aAcceptOutput, TInt aExitCommandId )
       
   258     {
       
   259     TPckg<TBool> acceptOutput( aAcceptOutput );
       
   260     TPckg<TInt> exitId( aExitCommandId );
       
   261     User::LeaveIfError( SendReceive( EPbk2ExitService,
       
   262         TIpcArgs( &acceptOutput, &exitId ) ) );
       
   263     }
       
   264 
       
   265 // --------------------------------------------------------------------------
       
   266 // RPbk2UIService::AcceptRequestL
       
   267 // --------------------------------------------------------------------------
       
   268 //
       
   269 void RPbk2UIService::AcceptRequestL
       
   270         ( TRequestStatus& aStatus, TInt& aNumContacts,
       
   271           HBufC8& aContactLink )
       
   272     {
       
   273     TPckg<TInt> numContacts( aNumContacts );
       
   274     iCountPtr.Set( numContacts );
       
   275     iContactLinkPtr.Set( aContactLink.Des() );
       
   276     SendReceive( EPbk2AcceptRequest,
       
   277         TIpcArgs( &iCountPtr, &iContactLinkPtr ), aStatus );
       
   278     }
       
   279 
       
   280 // --------------------------------------------------------------------------
       
   281 // RPbk2UIService::CancelAcceptRequest
       
   282 // --------------------------------------------------------------------------
       
   283 //
       
   284 void RPbk2UIService::CancelAcceptRequest()
       
   285     {
       
   286     SendReceive( EPbk2CancelAcceptRequest );
       
   287     }
       
   288 
       
   289 // --------------------------------------------------------------------------
       
   290 // RPbk2UIService::AcceptServiceL
       
   291 // --------------------------------------------------------------------------
       
   292 //
       
   293 void RPbk2UIService::AcceptServiceL
       
   294         ( TBool aAcceptOutput, HBufC8* aContactLink )
       
   295     {
       
   296     TPckg<TBool> acceptOutput( aAcceptOutput );
       
   297     if ( aContactLink )
       
   298         {
       
   299         iContactLinkPtr.Set( aContactLink->Des() );
       
   300         User::LeaveIfError(
       
   301             SendReceive( EPbk2AcceptService,
       
   302             TIpcArgs( &acceptOutput, &iContactLinkPtr ) ) );
       
   303         }
       
   304     }
       
   305 
       
   306 // --------------------------------------------------------------------------
       
   307 // RPbk2UIService::ServiceUid
       
   308 // --------------------------------------------------------------------------
       
   309 //
       
   310 TUid RPbk2UIService::ServiceUid() const
       
   311     {
       
   312     return TUid::Uid( KPbk2UIService );
       
   313     }
       
   314 
       
   315 // End of File