vmbx/vmbxengine/inc/vmbxpbkstore.h
changeset 12 ae8abd0db65c
child 19 e44a8c097b15
equal deleted inserted replaced
0:ff3b6d0fd310 12:ae8abd0db65c
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Access class to SIM
       
    15 *  Interface   : Private, CVmbxPbkStore
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_VMBXPHBSTORE_H
       
    21 #define C_VMBXPHBSTORE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <etelmm.h>
       
    26 
       
    27 #include <voicemailboxdefs.h>
       
    28 #include "voicemailboxdefsinternal.h"
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CVmbxETelConnection;
       
    32 class CPhoneBookBuffer;
       
    33 class CVoiceMailboxEntry;
       
    34 
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 *  Creates connection to Sim phonebook and handles data flow from/to it
       
    39 *
       
    40 *  @lib vmbxengine.lib
       
    41 *  @since S60 v5.2
       
    42 */
       
    43 NONSHARABLE_CLASS( CVmbxPbkStore ) : public CActive
       
    44     {
       
    45 
       
    46 public:  // Constructors and destructor
       
    47 
       
    48     /**
       
    49      * C++ 2 constructor.
       
    50      */
       
    51     static CVmbxPbkStore* NewL();
       
    52 
       
    53     /**
       
    54      * Destructor.
       
    55      */
       
    56     virtual ~CVmbxPbkStore();
       
    57 
       
    58 public: // New functions
       
    59 
       
    60     /**
       
    61      * Sim write support
       
    62      *
       
    63      * @since S60 v5.2
       
    64      * @return ETrue if writable
       
    65      */
       
    66     TBool IsWritable();
       
    67 
       
    68     /**
       
    69      * sim PhoneBook Type
       
    70      * @since S60 v5.2
       
    71      * @return TVmbxSimPhonebookType
       
    72      */
       
    73     TVmbxSimPhonebookType PhoneBookType();
       
    74 
       
    75     /**
       
    76      * Writes an entry into ICC-based phonebook.
       
    77      *
       
    78      * @since S60 v5.2
       
    79      * @param in aEntry Reference of CVoiceMailboxEntry
       
    80      * @return KErrNone if succesful,
       
    81      *         Other system wide errors.
       
    82      **/
       
    83     TInt Write( const CVoiceMailboxEntry& aEntry );
       
    84 
       
    85     /**
       
    86      * Retrieves hanlder of RMobilePhoneBookStore
       
    87      *
       
    88      * @since S60 v5.2
       
    89      * @retuns hanlder of RMobilePhoneBookStore
       
    90      */
       
    91     RMobilePhoneBookStore& PhonebookStore();
       
    92 
       
    93     /**
       
    94     * Retrieves mailbox number from Sim
       
    95     * @since S60 v5.2
       
    96     * @param out aEntry a data type CVoiceMailboxEntry
       
    97     */
       
    98     void GetL( CVoiceMailboxEntry& aEntry );
       
    99 
       
   100 private: // from base class CActive
       
   101 
       
   102      /**
       
   103       * @see CActive::RunL
       
   104       */
       
   105      void RunL();
       
   106 
       
   107      /**
       
   108       * @see CActive::DoCancel
       
   109       */
       
   110      void DoCancel();
       
   111 
       
   112     /**
       
   113      * @see CActive::RunError
       
   114      */
       
   115     TInt RunError(TInt aError);
       
   116 
       
   117 private: // New functions
       
   118 
       
   119     /**
       
   120      * Reads an entry from the ICC-based phonebook.
       
   121      *
       
   122      * @since S60 v5.2
       
   123      * @param out aEntry Reference of CVoiceMailboxEntry
       
   124      **/
       
   125     void SimReadL( CVoiceMailboxEntry& aEntry );
       
   126 
       
   127     /**
       
   128      * Opens VMBX phonebook
       
   129      * @since S60 v5.2
       
   130      * @retuns KErrNone if succesful
       
   131      **/
       
   132     TInt OpenVmbxPhonebook();
       
   133 
       
   134     /**
       
   135      * Opens MBDN phonebook
       
   136      * @since S60 v5.2
       
   137      * @retuns KErrNone if succesful
       
   138      **/
       
   139     TInt OpenMbdnPhonebook();
       
   140 
       
   141     /**
       
   142      * Get Phonebook Info
       
   143      * @param out aInfo information from RPhonebookStore
       
   144      *
       
   145      * @since S60 v5.2
       
   146      **/
       
   147     TInt GetVmbxInfo( RMobilePhoneBookStore::TMobilePhoneBookInfoV1& aInfo );
       
   148 
       
   149     /**
       
   150      * Retrieves the Mailbox numbers identifier information
       
   151      * @param in aAlsLine curent als line
       
   152      * @param out aInfo information from RPhonebookStore
       
   153      * @since S60 v5.2
       
   154      * @retuns KErrNone if succesful
       
   155      **/
       
   156     TInt GetMbdnInfo( const TVmbxAlsLineType aAlsLine,
       
   157             RMobilePhone::TMobilePhoneVoicemailIdsV3& aInfo );
       
   158 
       
   159 
       
   160     /**
       
   161      * Reads "ParseDataL" from phonebook data from Sim
       
   162      *
       
   163      * @since S60 v5.2
       
   164      * @param out aEntry entry of CVoiceMailboxEntry
       
   165      * @param in aPbData
       
   166      */
       
   167     void ParseDataL( CVoiceMailboxEntry& aEntry, TDes8& aPbData );
       
   168 
       
   169     /**
       
   170      * Reads "new-entry-tag" from phonebook data from Sim
       
   171      *
       
   172      * @since S60 v5.2
       
   173      * @param in aPbkBuffer Phonebook data buffer
       
   174      * @retuns KErrNone if succesful
       
   175      */
       
   176     TInt ReadNewEntryTag( CPhoneBookBuffer* aPbkBuffer );
       
   177 
       
   178     /**
       
   179      * Reads tags from buffer retrieved from sim
       
   180      *
       
   181      * @since S60 v5.2
       
   182      * @param in aPbkBuffer Phonebook data buffer
       
   183      * @param out aEntry Reference of CVoiceMailboxEntry
       
   184      */
       
   185     void ReadPbkDataL( CPhoneBookBuffer* aPbkBuffer, 
       
   186                         CVoiceMailboxEntry& aEntry );
       
   187 
       
   188     /**
       
   189      * Checks if sim-card is USim
       
   190      *
       
   191      * @since S60 v5.2
       
   192      * @return ETrue if USim
       
   193      **/
       
   194     TBool SimFileExistsAndReadAccess();
       
   195 
       
   196 protected:
       
   197 
       
   198     /**
       
   199      * C++ constructor.
       
   200      *
       
   201      * @since S60 v5.2
       
   202      */
       
   203     CVmbxPbkStore();
       
   204 
       
   205     /**
       
   206      * By default Symbian 2nd phase constructor is protected.
       
   207      */
       
   208     void ConstructL();
       
   209 
       
   210 protected: // data
       
   211 
       
   212     /**
       
   213      *Pointer to Telephony server and phone connection
       
   214      *Own
       
   215      */
       
   216      CVmbxETelConnection* iETelConnection;
       
   217 
       
   218     /**
       
   219      * Phonebook store client
       
   220      */
       
   221     RMobilePhoneBookStore iPhoneBook;
       
   222 
       
   223     /**
       
   224      * Sim Phonebook type
       
   225      */
       
   226     TVmbxSimPhonebookType iPhoneBookType;
       
   227 
       
   228     /**
       
   229      * Alpha string which is read from the SIM card
       
   230      * Own.
       
   231      */
       
   232      HBufC* iAlphaStringFromSIM;
       
   233 
       
   234     /**
       
   235      * CActiveSchedulerWait
       
   236      * Own.
       
   237      */
       
   238     CActiveSchedulerWait* iWait;
       
   239 
       
   240 
       
   241     /**
       
   242      * Asynchronous operation type of sim card
       
   243      */
       
   244     TVmbxSimAsynType iAsynType;
       
   245 
       
   246     };
       
   247 
       
   248 #endif      // C_VMBXPHBSTORE_H