adaptationlayer/tsy/nokiatsy_dll/inc/cmmphonebookoperationwrite.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     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 the License "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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMMPHONEBOOKOPERATIONWRITE_H
       
    19 #define CMMPHONEBOOKOPERATIONWRITE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <ctsy/pluginapi/cmmdatapackage.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "cmmphonebookstoreoperationbase.h"
       
    26 
       
    27 //  CONSTANTS
       
    28     //none
       
    29 
       
    30 //  MACROS
       
    31     //none
       
    32 
       
    33 //  DATA TYPES
       
    34     //none
       
    35 
       
    36 //  EXTERNAL DATA STRUCTURES
       
    37 
       
    38 //  FUNCTION PROTOTYPES
       
    39     //none
       
    40 
       
    41 // CLASS DECLARATION
       
    42 /**
       
    43 * CMmPhoneBookOperationWrite is used to create and send GSM-specific
       
    44 * PBStore ISI messages to PhoNet via PhoNetSender relating to write.
       
    45 */
       
    46 class CMmPhoneBookOperationWrite
       
    47     : public CMmPhoneBookStoreOperationBase
       
    48     {
       
    49     public:  // Constructors and destructor
       
    50 
       
    51         /**
       
    52         * Two-phased constructor.
       
    53         */
       
    54         static CMmPhoneBookOperationWrite* NewL(
       
    55             CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
       
    56             const CMmDataPackage* aDataPackage );
       
    57 
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         ~CMmPhoneBookOperationWrite();
       
    62 
       
    63         /**
       
    64         * This method created entry point to correct operation
       
    65         *
       
    66         * @param aPhonebookType PhoneBook type
       
    67         * @param aIpc IPC
       
    68         * @return Pointer to operation.
       
    69         */
       
    70         static CMmPhoneBookOperationWrite* Build(
       
    71             TName aPhonebookType,
       
    72             TInt aIpc );
       
    73 
       
    74   private:
       
    75 
       
    76         /**
       
    77         * By default Symbian OS constructor is private.
       
    78         */
       
    79         CMmPhoneBookOperationWrite();
       
    80 
       
    81         /**
       
    82         * Class attributes are created in ConstructL.
       
    83         */
       
    84         void ConstructL();
       
    85 
       
    86         /**
       
    87         * Separates different IPC requests for each other.
       
    88         *
       
    89         * @param aIpc Identify number of request.
       
    90         * @param aDataPackage Packaged data.
       
    91         * @return KErrNone or error value.
       
    92         */
       
    93         TInt CreateReq(
       
    94             TInt aIpc,
       
    95             const CMmDataPackage* aDataPackage );
       
    96 
       
    97         /**
       
    98         * Handles SimPbResp ISI -message
       
    99         *
       
   100         * @param aIsiMessage
       
   101         * @param aComplete Indicates if request can remove from
       
   102         *        operationlist or not.
       
   103         * @return KErrNone or error value.
       
   104         */
       
   105         TInt HandleSimPbRespL(
       
   106             const TIsiReceiveC& aIsiMessage,
       
   107             TBool& aComplete );
       
   108 
       
   109         /**
       
   110         * Handles HandleWriteResp ISI -message
       
   111         *
       
   112         * @param aIsiMessage
       
   113         * @param aComplete Indicates if request can remove from
       
   114         *        operationlist or not.
       
   115         * @return KErrNone or error value.
       
   116         */
       
   117         TInt HandleWriteResp(
       
   118             const TIsiReceiveC& aIsiMessage,
       
   119             TBool& aComplete );
       
   120 
       
   121         /**
       
   122         * Handling write response at delete phase
       
   123         *
       
   124         * @param aIsiMessage
       
   125         * @param aComplete Indicates if request can remove from
       
   126         *        operationlist or not.
       
   127         * @return KErrNone or error value.
       
   128         */
       
   129         TInt HandleWriteDeleteL(
       
   130             const TIsiReceiveC& aIsiMessage,
       
   131             TBool& aComplete );
       
   132 
       
   133         /**
       
   134         * Creates and sends ISI message in order to wite an entry to SIM
       
   135         *
       
   136         * @param aTraId Transaction id
       
   137         * @param aIndex Location index
       
   138         * @param aDataToWrite Entry to write
       
   139         * @return KErrNone or error value
       
   140         */
       
   141         TInt SimPbReqWriteL(
       
   142             TUint8 aTraId,
       
   143             TInt16 aIndex,
       
   144             CPhoneBookStoreEntry& aDataToWrite );
       
   145 
       
   146         /**
       
   147         * Creates and sends ISI message in order to wite an entry to SIM
       
   148         *
       
   149         * @param aTraId Transaction id
       
   150         * @param aIndex Location index
       
   151         * @return KErrNone or error value
       
   152         */
       
   153         TInt SimPbReqWriteDelete(
       
   154             TUint8 aTraId,
       
   155             const TInt16 aIndex );
       
   156 
       
   157         /**
       
   158         * Compose 3G data if available
       
   159         *
       
   160         * @param aDataToWrite Entry
       
   161         * @param aDataPtr Reference to data
       
   162         * @param aErrVal error value
       
   163         * @return KErrNone or error value
       
   164         */
       
   165         TInt Compose3GDataL(
       
   166             CPhoneBookStoreEntry& aDataToWrite,
       
   167             TDes8& aDataPtr
       
   168 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   169             ,TInt& aErrVal
       
   170 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   171              );
       
   172 
       
   173         /**
       
   174         * Count sublock length
       
   175         *
       
   176         * @param aDataToWrite Entry to write
       
   177         * @param aNumOfSubblocks Number of subblocks
       
   178         * @param aMessageLength MessageLength
       
   179         * @return None
       
   180         */
       
   181         void CountSublocksAndMessLength(
       
   182             CPhoneBookStoreEntry& aDataToWrite,
       
   183             TUint8& aNumOfSubblocks,
       
   184             TInt& aMessageLength );
       
   185 
       
   186         /**
       
   187         * Create SIM_DATA_SIZE_READ_REQ message.
       
   188         *
       
   189         * @param aTraId Transaction Id
       
   190         * @param aComplete
       
   191         * @return KErrNone or error value.
       
   192         */
       
   193         TInt BuildSimDataSizeReadReqData(
       
   194             TUint8 aTraId,
       
   195             TBool& aComplete );
       
   196 
       
   197         /**
       
   198         * Handling error situation
       
   199         *
       
   200         * @param aIsiMessage ISI message
       
   201         * @param aStatus Status from ISI message
       
   202         * @param aSbStartOffSet Offset to data
       
   203         * @return KErrNone or error value.
       
   204         */
       
   205         TInt ErrorStatusHandling(
       
   206             const TIsiReceiveC& aIsiMessage,
       
   207             TUint8 aStatus,
       
   208             TUint& aSbStartOffSet );
       
   209 
       
   210         /**
       
   211         * Add tSIM_SB_NAME_NUMBER
       
   212         *
       
   213         * @param aSubBlockId Subblock Id
       
   214         * @param aLocation Location
       
   215         * @param aName Reference to data name
       
   216         * @param aNumber Reference to data number
       
   217         * @param aDataToAppend Reference to data
       
   218         * @return None
       
   219         */
       
   220         void AddSimSbNameNumberSubBlock(
       
   221             TUint16& aSubBlockId,
       
   222             TInt16& aLocation,
       
   223             TDesC& aName,
       
   224             TDesC& aNumber,
       
   225             TDes8& aDataToAppend );
       
   226 
       
   227         /**
       
   228         * Add tSIM_SB_TEXT_NUMBER
       
   229         *
       
   230         * @param aSubBlockId Reference to subblock data
       
   231         * @param aLocation Location
       
   232         * @param aText Reference to text data
       
   233         * @param aDataToAppend Reference to data
       
   234         * @return None
       
   235         */
       
   236         void AddSimSbTextSubBlock(
       
   237             const TUint16& aSubBlockId,
       
   238             TInt16& aLocation,
       
   239             TDesC& aText,
       
   240             TDes8& aDataToAppend );
       
   241 
       
   242         /**
       
   243         * Add tSIM_SB_NUMBER_NUMBER
       
   244         *
       
   245         * @param aLocation Location
       
   246         * @param aNumber Reference to number
       
   247         * @param aAasRecordNumber AAS number
       
   248         * @param aDataToAppend Reference to data
       
   249         * @return None
       
   250         */
       
   251         void AddSimSbNumberSubBlock( const TUint16& aSubBlockId,
       
   252             TInt16& aLocation,
       
   253             TDesC& aNumber,
       
   254 
       
   255 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   256             TUint8 aAasRecordNumber,
       
   257 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   258             TDes8& aDataToAppend );
       
   259 #ifdef INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   260 
       
   261         /**
       
   262         * Add tSIM_SB_GROUP_NUMBER
       
   263         *
       
   264         * @param aSubBlockId
       
   265         * @param aGrpLocation
       
   266         * @param aGasLocations
       
   267         * @param aDataToAppend:
       
   268         * @return None
       
   269         */
       
   270         void AddSimSbGroupSubBlock( const TUint16& aSubBlockId,
       
   271             TInt16& aGrpLocation,
       
   272             CArrayFixFlat<TInt>* aGasLocations,
       
   273             TDes8& aDataToAppend );
       
   274 
       
   275         /**
       
   276         * Creates and sends ISI message in order to write alphastring to SIM.
       
   277         *
       
   278         * @param None
       
   279         * @return KErrNone or error value
       
   280         */
       
   281         TInt SimWriteAlphaStringReq();
       
   282 
       
   283         /**
       
   284         * Receives SIM_PB_RESP(SIM_PB_WRITE) ISI messages from phonet receiver
       
   285         *
       
   286         * @param aIsiMessage Reference to the received message.
       
   287         * @return KErrNone or error code
       
   288         */
       
   289         TInt SimWriteAlphaStringRespL( const TIsiReceiveC& aIsiMessage );
       
   290 #endif // INTERNAL_RD_USIM_PHONEBOOK_GAS_AND_AAS
       
   291 
       
   292 
       
   293     public:     // Data
       
   294         // None
       
   295 
       
   296     protected:  // Data
       
   297         // none
       
   298 
       
   299     private:    // Data
       
   300 
       
   301         // Attribute to hold the write enty while delete -request is on
       
   302         CPhoneBookStoreEntry* iPhoneBookEntry;
       
   303 
       
   304         // Keep track on current write -phase
       
   305         TPBWritePhases iCurrentWritePhase;
       
   306 };
       
   307 
       
   308 #endif // CMMPHONEBOOKOPERATIONWRITE_H
       
   309 
       
   310 // End of file