vmbx/vmbxengine/inc/vmbxpbkstore.h
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*
       
     2 * Copyright (c) 2009-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:  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 */
       
    42 NONSHARABLE_CLASS( CVmbxPbkStore ) : public CActive
       
    43     {
       
    44 
       
    45 public:  // Constructors and destructor
       
    46 
       
    47     /**
       
    48      * C++ 2 constructor.
       
    49      */
       
    50     static CVmbxPbkStore* NewL();
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CVmbxPbkStore();
       
    56 
       
    57 public: // New functions
       
    58 
       
    59     /**
       
    60      * Sim write support
       
    61      *
       
    62      * @return ETrue if writable
       
    63      */
       
    64     TBool IsWritable();
       
    65 
       
    66     /**
       
    67      * sim PhoneBook Type
       
    68      * @return TVmbxSimPhonebookType
       
    69      */
       
    70     TVmbxSimPhonebookType PhoneBookType();
       
    71 
       
    72     /**
       
    73      * Writes an entry into ICC-based phonebook.
       
    74      *
       
    75      * @param in aEntry Reference of CVoiceMailboxEntry
       
    76      * @return KErrNone if succesful,
       
    77      *         Other system wide errors.
       
    78      **/
       
    79     TInt Write( const CVoiceMailboxEntry& aEntry );
       
    80 
       
    81     /**
       
    82      * Retrieves hanlder of RMobilePhoneBookStore
       
    83      *
       
    84      * @retuns hanlder of RMobilePhoneBookStore
       
    85      */
       
    86     RMobilePhoneBookStore& PhonebookStore();
       
    87 
       
    88     /**
       
    89     * Retrieves mailbox number from Sim
       
    90     * @param out aEntry a data type CVoiceMailboxEntry
       
    91     */
       
    92     void GetL( CVoiceMailboxEntry& aEntry );
       
    93 
       
    94 private: // from base class CActive
       
    95 
       
    96      /**
       
    97       * @see CActive::RunL
       
    98       */
       
    99      void RunL();
       
   100 
       
   101      /**
       
   102       * @see CActive::DoCancel
       
   103       */
       
   104      void DoCancel();
       
   105 
       
   106     /**
       
   107      * @see CActive::RunError
       
   108      */
       
   109     TInt RunError(TInt aError);
       
   110 
       
   111 private: // New functions
       
   112 
       
   113     /**
       
   114      * Reads an entry from the ICC-based phonebook.
       
   115      *
       
   116      * @param out aEntry Reference of CVoiceMailboxEntry
       
   117      **/
       
   118     void SimReadL( CVoiceMailboxEntry& aEntry );
       
   119 
       
   120     /**
       
   121      * Opens VMBX phonebook
       
   122      * @retuns KErrNone if succesful
       
   123      **/
       
   124     TInt OpenVmbxPhonebook();
       
   125 
       
   126     /**
       
   127      * Opens MBDN phonebook
       
   128      * @retuns KErrNone if succesful
       
   129      **/
       
   130     TInt OpenMbdnPhonebook();
       
   131 
       
   132     /**
       
   133      * Get Phonebook Info
       
   134      * @param out aInfo information from RPhonebookStore
       
   135      *
       
   136      **/
       
   137     TInt GetVmbxInfo( RMobilePhoneBookStore::TMobilePhoneBookInfoV1& aInfo );
       
   138 
       
   139     /**
       
   140      * Retrieves the Mailbox numbers identifier information
       
   141      * @param out aInfo information from RPhonebookStore
       
   142      * @retuns KErrNone if succesful
       
   143      **/
       
   144     TInt GetMbdnInfo( RMobilePhone::TMobilePhoneVoicemailIdsV3& aInfo );
       
   145 
       
   146 
       
   147     /**
       
   148      * Reads "ParseDataL" from phonebook data from Sim
       
   149      *
       
   150      * @param out aEntry entry of CVoiceMailboxEntry
       
   151      * @param in aPbData
       
   152      */
       
   153     void ParseDataL( CVoiceMailboxEntry& aEntry, TDes8& aPbData );
       
   154 
       
   155     /**
       
   156      * Reads "new-entry-tag" from phonebook data from Sim
       
   157      *
       
   158      * @param in aPbkBuffer Phonebook data buffer
       
   159      * @retuns KErrNone if succesful
       
   160      */
       
   161     TInt ReadNewEntryTag( CPhoneBookBuffer* aPbkBuffer );
       
   162 
       
   163     /**
       
   164      * Reads tags from buffer retrieved from sim
       
   165      *
       
   166      * @param in aPbkBuffer Phonebook data buffer
       
   167      * @param out aEntry Reference of CVoiceMailboxEntry
       
   168      */
       
   169     void ReadPbkDataL( CPhoneBookBuffer* aPbkBuffer, 
       
   170                         CVoiceMailboxEntry& aEntry );
       
   171 
       
   172     /**
       
   173      * Checks sim file existing
       
   174      *
       
   175      * @retuns ETrue if file exists
       
   176      **/
       
   177     TBool IsSimFileExisting( const TVmbxSimPhonebookType aType );
       
   178 
       
   179     /**
       
   180      * Sim write acces support
       
   181      *
       
   182      * @return ETrue if writable access
       
   183      */
       
   184     TBool IsWriteAccess();
       
   185 
       
   186 protected:
       
   187 
       
   188     /**
       
   189      * C++ constructor.
       
   190      *
       
   191      */
       
   192     CVmbxPbkStore();
       
   193 
       
   194     /**
       
   195      * By default Symbian 2nd phase constructor is protected.
       
   196      */
       
   197     void ConstructL();
       
   198 
       
   199 protected: // data
       
   200 
       
   201     /**
       
   202      *Pointer to Telephony server and phone connection
       
   203      *Own
       
   204      */
       
   205      CVmbxETelConnection* iETelConnection;
       
   206 
       
   207     /**
       
   208      * Phonebook store client
       
   209      */
       
   210     RMobilePhoneBookStore iPhoneBook;
       
   211 
       
   212     /**
       
   213      * Sim Phonebook type
       
   214      */
       
   215     TVmbxSimPhonebookType iPhoneBookType;
       
   216 
       
   217     /**
       
   218      * CActiveSchedulerWait
       
   219      * Own.
       
   220      */
       
   221     CActiveSchedulerWait* iWait;
       
   222 
       
   223 
       
   224     /**
       
   225      * Asynchronous operation type of sim card
       
   226      */
       
   227     TVmbxSimAsynType iAsynType;
       
   228 
       
   229     };
       
   230 
       
   231 #endif      // C_VMBXPHBSTORE_H