phonebookengines/VirtualPhonebook/inc/RVPbkSimStore.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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:  The sim store subsession class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef RVPBKSIMSTORE_H
       
    21 #define RVPBKSIMSTORE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <VPbkSimStoreCommon.h>
       
    26 #include <VPbkSimServerCommon.h>
       
    27 #include <MVPbkSimPhone.h>
       
    28 #include <RVPbkStreamedIntArray.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 struct TVPbkGsmStoreProperty;
       
    32 struct TVPbkUSimStoreProperty;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 *  The sim store subsession class
       
    38 *
       
    39 */
       
    40 class RVPbkSimStore : public RSessionBase
       
    41     {
       
    42     public: // Construction
       
    43 
       
    44         /**
       
    45         * C++ default constructor
       
    46         */
       
    47         IMPORT_C RVPbkSimStore();
       
    48 
       
    49     public: // New functions
       
    50         
       
    51         /**
       
    52         * Starts the server if not started and creates a connection to it.
       
    53         */
       
    54         IMPORT_C void ConnectToServerL();
       
    55 
       
    56         /**
       
    57         * Closes this session
       
    58         */
       
    59         IMPORT_C void Close();
       
    60 
       
    61         /**
       
    62         * Opens the store in the server side.
       
    63         * @param aSecurityInfo Security information of client.
       
    64         * @param aIdentifier one of the identifiers defined in
       
    65         *        VPbkSimStoreCommon.h
       
    66         */
       
    67         IMPORT_C void OpenL( const TSecurityInfo& aSecurityInfo, 
       
    68                              TVPbkSimStoreIdentifier aIdentifier );
       
    69 
       
    70         /**
       
    71         * Cancels asynchronous store request.
       
    72         * @param aReqToCancel an asynchronous operation code 
       
    73         *        from VPbkSimServerOpCodes.h
       
    74         */
       
    75         IMPORT_C void CancelAsyncRequest( TInt aReqToCancel );
       
    76             
       
    77         /**
       
    78         * Starts listening to store events. This should be called before OpenL
       
    79         * to get the EVPbkSimStoreOpen event. Client should keep this active
       
    80         * all the time to get EVPbkSimStoreNotAvailable events.
       
    81         * @param aStatus the status that is completed by the server
       
    82         *   after request is done.
       
    83         * @param aEvent the event that is updated by the server
       
    84         * @param aError KErrNone if event is EVPbkSimStoreOpen or 
       
    85         *               EVPbkSimStoreNotAvailable
       
    86         *               KErrNotSupported if the event is EVPbkSimStoreError and
       
    87         *               (U)SIM card doesn't support the store.
       
    88         *               Other system error like KErrNoMemory.
       
    89         * @exception KErrAlreadyExists if already called
       
    90         */
       
    91         IMPORT_C void ListenToStoreEvents( TRequestStatus& aStatus,
       
    92             TVPbkSimContactEventData& aEvent );
       
    93 
       
    94         /**
       
    95         * Returns the contact in the specified index in ETel format or NULL if
       
    96         * contact was not found
       
    97         * @param aSimIndex the sim index of the contact
       
    98         * @return a contact or NULL
       
    99         */
       
   100         IMPORT_C HBufC8* ReadLC( TInt aSimIndex );
       
   101 
       
   102         /**
       
   103         * Saves a contact to the (U)SIM.
       
   104         * @param aStatus the status that is completed after request is done.
       
   105         * @param aData the contact in ETel format
       
   106         * @param aSimIndex the sim index to save or 
       
   107         *       VPbkSimStoreImpl::KFirstFreeSimIndex
       
   108         */
       
   109         IMPORT_C void SaveL( TRequestStatus& aStatus, const TDesC8& aData, 
       
   110             TInt& aSimIndex );
       
   111         
       
   112         /**
       
   113         * Deletes many contacts from the (U)SIM
       
   114         * @param aStatus the status that is completed after request is done.
       
   115         * @param aSimIndexes array of indexes to be deleted
       
   116         */
       
   117         IMPORT_C void DeleteL( TRequestStatus& aStatus, 
       
   118                               RVPbkStreamedIntArray& aSimIndexes );
       
   119 
       
   120         /**
       
   121         * Fills the GSM store properties
       
   122         * @param aGSMProperties the GSM store properties 
       
   123         * @return KErrNone or system wide error code
       
   124         */
       
   125         IMPORT_C TInt GetGsmStoreProperties( TVPbkGsmStoreProperty& 
       
   126                                                     aGsmProperties ) const;
       
   127 
       
   128         /**
       
   129         * Fills the USIM store properties. If the store doesn't support
       
   130         * USIM properties then all the values are KVPbkSimStorePropertyUndefined
       
   131         * @param aUSimProperties the USIM store properties
       
   132         * @return KErrNone or system wide error code
       
   133         */
       
   134         IMPORT_C TInt GetUSimStoreProperties( TVPbkUSimStoreProperty& 
       
   135                                                     aUSimProperties ) const;
       
   136 
       
   137         /**
       
   138         * Finds a phone number match from the store
       
   139         * Completes with KErrNotFound if there was no match.
       
   140         * Completes with KErrOverflow if the result buffer was too small
       
   141         *
       
   142         * @param aStatus the status that is completed after request is done.
       
   143         * @param aPhoneNumber the phone number to match
       
   144         * @param aMaxMatchDigits the maximum digits from the end of to number
       
   145         *        to use in match
       
   146         * @param aSimIndexBuffer a buffer for results that are sim indexes
       
   147         */
       
   148         IMPORT_C void MatchPhoneNumber( TRequestStatus& aStatus,
       
   149             const TDesC& aPhoneNumber, TInt aMaxMatchDigits,
       
   150             TDes8& aSimIndexBuffer );
       
   151         
       
   152         /**
       
   153         * Finds a match for a text string.
       
   154         * Completes with KErrNotFound if there was no match.
       
   155         * Completes with KErrOverflow if the result buffer was too small
       
   156         * Completes with KErrArgument if invalid field types
       
   157         *
       
   158         * @param aStatus the status that is completed after request is done.
       
   159         * @param aStringToFind the text string to find. This must exist as long
       
   160         *        as the request is handled.
       
   161         * @param aFieldTypes a descriptor containing TVPbkSimCntFieldType
       
   162         *        RVPbkSimFieldTypeArray can be used to externalize types.
       
   163         * @param aSimIndexBuffer a buffer for results, the matched sim indexes
       
   164         *        will be appended to this buffer.
       
   165         *        RVPbkStreamedIntArray can be used to interalize indexes.
       
   166         */
       
   167         IMPORT_C void Find( TRequestStatus& aStatus,
       
   168             const TDesC& aStringToFind, const TDesC8& aFieldTypes,
       
   169             TDes8& aSimIndexBuffer );
       
   170             
       
   171         /**
       
   172          * Opens the phone in server side.
       
   173          */
       
   174         IMPORT_C void OpenPhoneL();
       
   175 
       
   176         /**
       
   177          * Closes the phone in server side.
       
   178          */
       
   179         IMPORT_C void ClosePhone();
       
   180 
       
   181         /**
       
   182          * Returns whether the usim access is supported or not.
       
   183          * @return ETrue if usim access is supported, otherwise EFalse.
       
   184          */
       
   185         IMPORT_C TBool USimAccessSupported() const;
       
   186 
       
   187         /**
       
   188          * Returns the service table
       
   189          * @return service table
       
   190          */
       
   191         IMPORT_C TUint32 ServiceTable() const;
       
   192 
       
   193         /**
       
   194          * Returns fixed dialling status
       
   195          * @return FDN status
       
   196          */
       
   197         IMPORT_C MVPbkSimPhone::TFDNStatus FixedDialingStatus() const;            
       
   198 
       
   199     private:    // Data
       
   200         /// A descriptor for the store event
       
   201         TPtr8 iEvent;
       
   202         /// A descriptor for the store error
       
   203         TPtr8 iStoreError;
       
   204         /// The sim index of the saved contact
       
   205         TPtr8 iSavedSimIndex;
       
   206         /// Sim Index buffer
       
   207         HBufC8* iIndexBuffer;
       
   208     };
       
   209 
       
   210 #endif      // RVPBKSIMSTORE_H
       
   211             
       
   212 // End of File