phoneuis/easydialing/edcontactor/inc/edcontactorservice.h
branchRCL_3
changeset 9 8871b09be73b
equal deleted inserted replaced
4:c84cf270c54f 9:8871b09be73b
       
     1 /*
       
     2 * Copyright (c) 2010 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:  This is a class for starting services
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __EDCONTACTORSERVICE_H__
       
    19 #define __EDCONTACTORSERVICE_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <f32file.h>
       
    24 #include <VPbkFieldTypeSelectorFactory.h>
       
    25 
       
    26 //FORWARD DECLARATIONS
       
    27 
       
    28 class CEDContactorServiceOperator;
       
    29 class MEDContactorObserver;
       
    30 
       
    31 
       
    32 /**
       
    33  *  CEDContactorService
       
    34  *
       
    35  *  Class for starting services of CCA contactor service.
       
    36  *  @code
       
    37  *      HBufC* fullName = GetFullNameLC();
       
    38  *      CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC();
       
    39  *      linkArray->AppendL(iContactLink);
       
    40  *      HBufC8* streamedArray = linkArray->PackLC();
       
    41  *
       
    42  *      //Set control flags.
       
    43  *      TUint flags;
       
    44  *      flags |= CEDContactorService::TCSParameter::EEnableDefaults;
       
    45  *
       
    46  *      CEDContactorService::TCSParameter params(VPbkFieldTypeSelectorFactory::EVoiceCallSelector, *streamedArray, flags, *fullName);
       
    47  *      CEDContactorService::ExecuteServiceL(params);
       
    48  *
       
    49  *      CleanupStack::PopAndDestroy(3); //linkArray, streamedArray, fullName
       
    50  *
       
    51  *  @endcode
       
    52  *
       
    53  *  @lib CEDContactorService
       
    54  *  @since S60 v5.0
       
    55  */
       
    56 NONSHARABLE_CLASS(CEDContactorService) : public CBase
       
    57     {
       
    58 public:
       
    59 
       
    60     /**
       
    61      * Parameter class for the service.
       
    62      *
       
    63      * @since S60 v5.0
       
    64      */
       
    65     class TCSParameter
       
    66         {
       
    67         public:
       
    68 
       
    69         /** Flags for controlling CCA Contactor Service */
       
    70         enum TControlFlags
       
    71             {
       
    72             /**
       
    73              * Enable defaults. If this is set, AIW popup query will automatically search possible
       
    74              * default settings and if found one, it doesn't show selection query at all.
       
    75              */
       
    76             EEnableDefaults  = 0x0001,
       
    77             
       
    78             /**
       
    79              * Execute service as forced. If this is set, then voice call will be
       
    80              * executed as forced cs voice call. Doesn't affect other services currently.
       
    81              */
       
    82             EForcedService = 0x0002
       
    83             };
       
    84 
       
    85         /*
       
    86          * Constructor
       
    87          */
       
    88         inline TCSParameter(
       
    89                 VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aCommTypeSelector,
       
    90                 TDesC8& aContactLinkArray, TUint aControlFlag, TDesC& aFullName) :
       
    91                 iCommTypeSelector(aCommTypeSelector),
       
    92                 iContactLinkArray(aContactLinkArray),
       
    93                 iControlFlag(aControlFlag),
       
    94                 iFullName(aFullName)
       
    95             {
       
    96             };
       
    97 
       
    98          /*
       
    99          * Enumeration for inticating which communication method is wanted to use.
       
   100          */
       
   101         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector iCommTypeSelector;
       
   102 
       
   103         /*
       
   104          * Streamed contact link array of contact who will be communicated at.
       
   105          */
       
   106         TDesC8& iContactLinkArray;
       
   107 
       
   108         /**
       
   109          * Flag for controlling behaviour of service. Currently only set of default 
       
   110          * and forced service supported.
       
   111          */
       
   112         TUint iControlFlag;
       
   113 
       
   114         /*
       
   115          * Some communication methods requires contacts name order to use services.
       
   116          * (for example mms/sms editor)
       
   117          */
       
   118         TDesC& iFullName;
       
   119         };
       
   120 
       
   121     /**
       
   122      *
       
   123      */
       
   124     IMPORT_C static CEDContactorService* NewL( MEDContactorObserver* aObserver );
       
   125 
       
   126     /**
       
   127      * Destructor.
       
   128      */
       
   129     virtual ~CEDContactorService();
       
   130 
       
   131     /**
       
   132      * Start communication service.
       
   133      *
       
   134      * If the contactlink contains a multiple contact fields for selected communication
       
   135      * method, the executed service will launch Phbk AIW selection popup. User have to select
       
   136      * wanted field to be used for communication.
       
   137      * The communication method is defined by TVPbkCommTypeSelector.
       
   138      * After selection, communication is automatically started by the service.
       
   139      *
       
   140      * @see TVPbkCommTypeSelector from VPbkFieldTypeSelectorFactory.h.
       
   141      * Leaves KErrArgument if given parameter doesn't have valid values.
       
   142      *
       
   143      * @since S60 5.0
       
   144      * @param aParameter: The Launch Parameter.
       
   145      */
       
   146     IMPORT_C void ExecuteServiceL(const TCSParameter& aParameter);
       
   147 
       
   148     /**
       
   149      * Cancels an ongoing service execution.
       
   150      */
       
   151     IMPORT_C void CancelService();
       
   152     
       
   153     /**
       
   154      * Is contactor service busy.
       
   155      */
       
   156     IMPORT_C TBool IsBusy() const;
       
   157 
       
   158 private:
       
   159     /**
       
   160      * Constructor.
       
   161      */
       
   162     CEDContactorService( MEDContactorObserver* aObserver );
       
   163 
       
   164     /**
       
   165      *
       
   166      */
       
   167     void ConstructL();
       
   168 
       
   169 private:
       
   170     // data
       
   171 
       
   172     /**
       
   173      *
       
   174      */
       
   175     CEDContactorServiceOperator* iOperator;
       
   176     
       
   177     /**
       
   178      * ETrue, if command is being handled at the moment
       
   179      */
       
   180     TBool iCommandIsBeingHandled;
       
   181     
       
   182     TInt iResourceFileOffset;
       
   183     
       
   184     MEDContactorObserver* iObserver;
       
   185     };
       
   186 
       
   187 #endif      //__EDCONTACTORSERVICE_H__
       
   188 
       
   189 // End of File