telephonyserverplugins/common_tsy/commontsy/inc/mmcustomtsy/CMmSIMTsy.h
changeset 0 3553901f7fa8
child 5 7ef16719d8cb
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 /*
       
     2 * Copyright (c) 2006-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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMMSIMTSY_H
       
    21 #define CMMSIMTSY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "CMmCustomTsy.h"
       
    25 #include "cmmtsyreqhandlestore.h"
       
    26 #include "CMmSubTsyBase.h"
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KNoCbIds = -1;
       
    30 
       
    31 // From Viag HomeZone specification
       
    32 const TInt KPhEngMaxViagHomeZones = 4;
       
    33 // From Viag HomeZone specification
       
    34 const TInt KPhEngMaxCacheId = 21;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  CMmSIMTsy contains mode-independent SIM functionality.
       
    40 *  Extension request handles and parameters are stored as attributes.
       
    41 */
       
    42 NONSHARABLE_CLASS( CMmSIMTsy ) : public CMmSubTsyBase
       
    43     {
       
    44     public:
       
    45 
       
    46     // TSIMRequestType enumerates indexes to SIM's request handle
       
    47     // table. Request handles are stored there while waiting for
       
    48     // completion of the request.
       
    49     enum TSIMRequestType
       
    50         {
       
    51         ESIMTsyReqHandleUnknown,
       
    52         ESIMRequestTypeReadParams,
       
    53         ESIMRequestTypeReadCache,
       
    54         ESIMRequestTypeWriteCache,
       
    55         ESIMRequestTypeWriteSettings,
       
    56         ESIMRequestTypeStartSimCbTopicBrowsing,
       
    57         ESIMRequestTypeGetNextSimCbTopic,
       
    58         ESIMRequestTypeDeleteSimCbTopic,
       
    59 
       
    60         // Declare constant for those requests that need own request handle 
       
    61         // record in iTsyReqHandleStore above the following
       
    62         ESIMRequestTypeMaxNumOfRequests,
       
    63 
       
    64         // Let the next literal be the last
       
    65         ESIMRequestTypeUndefined = 0xff
       
    66         };
       
    67 
       
    68     public:  // Constructors and destructor
       
    69 
       
    70         /**
       
    71          * C++ default constructor.
       
    72          */
       
    73         CMmSIMTsy();
       
    74 
       
    75         /**
       
    76          * Two-phased constructor.
       
    77          */
       
    78         static CMmSIMTsy* NewL( CMmCustomTsy* mmCustomTsy );
       
    79 
       
    80         /**
       
    81          * Destructor.
       
    82          */
       
    83         ~CMmSIMTsy();
       
    84 
       
    85     public:
       
    86 
       
    87         /**
       
    88          * Initialisation method
       
    89          *         
       
    90          *
       
    91          */
       
    92         void Init();
       
    93 
       
    94         /**
       
    95          * Tells whether the object supports given IPC.
       
    96          *         
       
    97          *
       
    98          * @param aIpc Request's IPC value
       
    99          * @return ETrue if object supports given IPC
       
   100          */
       
   101         TBool SupportingIPC( const TInt aIpc );
       
   102 
       
   103         /**
       
   104          * Handles extended client requests. Uses TRAP to ensure functioning on
       
   105          * memory allocation failure.
       
   106          *         
       
   107          *
       
   108          * @param aTsyReqHandle Request handle
       
   109          * @param aIpc Request's IPC value
       
   110          * @param aPackage Reference to a data package
       
   111          * @return Error value
       
   112          */
       
   113         TInt DoExtFuncL( const TTsyReqHandle aTsyReqHandle, 
       
   114             const TInt aIpc, 
       
   115             const TDataPackage& aPackage );
       
   116 
       
   117         /**
       
   118          * Returns request mode for given IPC number.
       
   119          *         
       
   120          *
       
   121          * @param aIpc An interprocess communication command identifier
       
   122          * @return The ReqMode corresponding to given IPC
       
   123          */
       
   124         CTelObject::TReqMode ReqModeL( const TInt aIpc );
       
   125 
       
   126         /**
       
   127          * Returns number of slots to be used for given IPC.
       
   128          *         
       
   129          *       
       
   130          * @param aIpc An interprocess communication command identifier
       
   131          * @return The number of slots reserved for a given IPC
       
   132          */
       
   133         TInt NumberOfSlotsL( const TInt aIpc );
       
   134 
       
   135         /**
       
   136          * Cancels request of which IPC number and request handle 
       
   137          * are given in parameters.
       
   138          *         
       
   139          *
       
   140          * @param aIpc An interprocess communication command identifier
       
   141          * @param aTsyReqHandle Request handle
       
   142          * @return Error value
       
   143          */
       
   144         TInt CancelService( const TInt aIpc, 
       
   145             const TTsyReqHandle aTsyReqHandle );
       
   146 
       
   147         /**
       
   148          * Register given notification.
       
   149          *         
       
   150          *
       
   151          * @param aIpc An interprocess communication command identifier
       
   152          * @return KErrNotSupported
       
   153          */
       
   154         TInt RegisterNotification( const TInt aIpc );
       
   155 
       
   156         /**
       
   157          * Deregister given notification.
       
   158          *         
       
   159          *
       
   160          * @param aIpc An interprocess communication command identifier
       
   161          * @return KErrNotSupported
       
   162          */
       
   163         TInt DeregisterNotification( const TInt aIpc );
       
   164 
       
   165     public:
       
   166 
       
   167         /**
       
   168          * Sends VIAG homezone parameters read request if requested by client.
       
   169          *         
       
   170          *
       
   171          */
       
   172         void CheckViagHomezoneParamsL();
       
   173 
       
   174         /**
       
   175          * Completes the ReadViagHomeZoneParamsResp response message.
       
   176          *         
       
   177          *
       
   178          * @param aParams Pointer to VIAG Home Zone parameters structure
       
   179          * @param aElems Pointer to VIAG Home Zone elements structure
       
   180          * @param aError Error value
       
   181          */
       
   182         void CompleteReadViagHomeZoneParamsResp( 
       
   183             RMmCustomAPI::TViagParams* aParams,
       
   184             RMmCustomAPI::TViagElements* aElems,
       
   185             TInt aError );
       
   186 
       
   187         /**
       
   188          * Completes the ReadViagHomeZoneCacheResp response message.
       
   189          *         
       
   190          *
       
   191          * @param aViagRecord Pointer to VIAG Home Zone record content
       
   192          * @param aError Error value
       
   193          */
       
   194         void CompleteReadViagHomeZoneCacheRespL(
       
   195             RMmCustomAPI::TViagCacheRecordContent* aViagRecord,
       
   196             TInt aError );
       
   197 
       
   198         /**
       
   199          * Completes the WriteViagHomeZoneCacheResp response message.
       
   200          *         
       
   201          *
       
   202          * @param aError Error value
       
   203          */
       
   204         void CompleteWriteViagHomeZoneCacheResp( TInt aError );
       
   205 
       
   206         /**
       
   207          * Completes the WriteViagHomeZoneUHZIUESettings response message.
       
   208          *         
       
   209          * @param aError Error value
       
   210          */
       
   211         void CompleteWriteViagHomeZoneUHZIUESettingsResp( TInt aError );
       
   212 
       
   213         /**
       
   214          * Complete StartSimCbTopicBrowsing
       
   215          *         
       
   216          * @param aTopics CB Topics from SIM
       
   217          * @param aError Error value
       
   218          */
       
   219         void CompleteStartSimCbTopicBrowsing( 
       
   220             CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* aTopics,
       
   221             TInt aError );
       
   222 
       
   223         /**
       
   224          * Completes delete SIM CB topic request
       
   225          *         
       
   226          *
       
   227          * @param aError Error value
       
   228          */
       
   229         void CompleteDeleteSimCbTopic( TInt aError );
       
   230 
       
   231 
       
   232 #ifdef REQHANDLE_TIMER
       
   233         /**
       
   234          * Calls the needed complete method due the timer expiration
       
   235          *         
       
   236          *
       
   237          * @param aReqHandleType
       
   238          * @param aError
       
   239          */
       
   240         void Complete( TInt aReqHandleType, TInt aError );
       
   241 #endif //REQHANDLE_TIMER
       
   242 
       
   243     private:
       
   244 
       
   245         /**
       
   246          * By default EPOC constructor is private.
       
   247          *         
       
   248          *
       
   249          * @param aMmCustomTsy
       
   250          */
       
   251         void ConstructL( CMmCustomTsy* aMmCustomTsy );
       
   252 
       
   253         /**
       
   254          * Read ViagHomeZoneParams
       
   255          *         
       
   256          *
       
   257          * @param aViagParameters: Pointer to VIAG HomeZone parameters structure
       
   258          * @param aViagElements Pointer to VIAG Home Zone elements structure
       
   259          * @return Error value
       
   260          */
       
   261         TInt ReadViagHomeZoneParamsL( RMmCustomAPI::TViagParams* aViagParameters,
       
   262             RMmCustomAPI::TViagElement* aViagElements );
       
   263 
       
   264         /**
       
   265          * Read ViagHomeZoneCache
       
   266          *         
       
   267          *
       
   268          * @param aViagRecordId
       
   269          * @param aViagRecordContent
       
   270          * @return Error value
       
   271          */
       
   272         TInt ReadViagHomeZoneCacheL(
       
   273             RMmCustomAPI::TViagCacheRecordId* aViagRecordId,
       
   274             RMmCustomAPI::TViagCacheRecordContent* aViagRecordContent );
       
   275 
       
   276         /**
       
   277          * Read Dynamic ViagHomeZoneCache
       
   278          *         
       
   279          *
       
   280          * @param aTsyReqHandle
       
   281          * @param aViagRecordId
       
   282          * @param aViagRecordContent
       
   283          * @return Error value
       
   284          */
       
   285         TInt ReadDynamicViagHomeZoneCacheL(
       
   286             const TTsyReqHandle aTsyReqHandle,
       
   287             RMmCustomAPI::TViagCacheRecordId* aViagRecordId,
       
   288             RMmCustomAPI::TViagCacheRecordContent* aViagRecordContent );
       
   289 
       
   290         /**
       
   291          * Start dynamic caching
       
   292          *         
       
   293          *
       
   294          */
       
   295         void StartDynamicCachingL();
       
   296 
       
   297         /**
       
   298          * Write ViagHomeZoneCache
       
   299          *         
       
   300          *
       
   301          * @param aViagRecordId Pointer to VIAG Home Zone record id structure
       
   302          * @param aViagRecordContent Pointer to VIAG Home Zone record 
       
   303          *        content structure
       
   304          * @return Error value
       
   305          */
       
   306         TInt WriteViagHomeZoneCacheL(
       
   307             RMmCustomAPI::TViagCacheRecordId* aViagRecordId,
       
   308             RMmCustomAPI::TViagCacheRecordContent* aViagRecordContent );
       
   309 
       
   310         /**
       
   311          * Cancel the ReadViagHomeZoneParams request
       
   312          *         
       
   313          *
       
   314          * @return KErrNone
       
   315          */
       
   316         TInt ReadViagHomeZoneParamsCancel();
       
   317 
       
   318         /**
       
   319          * Cancel the ReadViagHomeZoneCache request
       
   320          *         
       
   321          *
       
   322          * @return KErrNone
       
   323          */
       
   324         TInt ReadViagHomeZoneCacheCancel( 
       
   325             const TTsyReqHandle aTsyReqHandle );
       
   326 
       
   327         /**
       
   328          * Cancel the WriteViagHomeZoneCache request
       
   329          *         
       
   330          *
       
   331          * @return KErrNone
       
   332          */
       
   333         TInt WriteViagHomeZoneCacheCancel();
       
   334 
       
   335         /**
       
   336          * Writes specified VIAG Home Zone UHZIUE settings to SIM.
       
   337          *         
       
   338          * @param aSettings Pointer to TViagUHZIUESettings
       
   339          * @return Error value
       
   340          */
       
   341         TInt WriteViagHomeZoneUHZIUESettingsL( 
       
   342             RMmCustomAPI::TViagUHZIUESettings* aSettings );
       
   343 
       
   344         /**
       
   345          * Cancels the VIAG Home Zone UHZIUE settings write request.
       
   346          *         
       
   347          * @param ?arg1 ?description
       
   348          * @return Error value
       
   349          */
       
   350         TInt WriteViagHomeZoneUHZIUESettingsCancel();
       
   351 
       
   352         /**
       
   353          * Start Sim Cb Topics Browsing
       
   354          *         
       
   355          *
       
   356          * @param aTsyReqHandle Request handle
       
   357          * @return Error value
       
   358          */
       
   359         TInt StartSimCbTopicBrowsingL( const TTsyReqHandle aTsyReqHandle );
       
   360 
       
   361         /**
       
   362          * Get Next Sim Cb Topic
       
   363          *         
       
   364          *
       
   365          * @param aTsyReqHandle Request handle
       
   366          * @param aSimCbTopic Pointer to TSimCbTopic structure
       
   367          * @return Error value
       
   368          */
       
   369         TInt GetNextSimCbTopic( TTsyReqHandle aTsyReqHandle, 
       
   370             RMmCustomAPI::TSimCbTopic* aSimCbTopic );
       
   371 
       
   372         /**
       
   373          * Delete Sim Cb Topic
       
   374          *         
       
   375          *
       
   376          * @param aTsyReqHandle Request handle
       
   377          * @param aSimCbTopicNumber ID number of the sim topic
       
   378          * @return Error value
       
   379          */
       
   380         TInt DeleteSimCbTopicL( const TTsyReqHandle aTsyReqHandle, 
       
   381             TUint* aSimCbTopicNumber );
       
   382 
       
   383         /**
       
   384          * Reset and destroy sim cb topics
       
   385          *         
       
   386          *
       
   387          */
       
   388         void ResetAndDestroySimCbTopics();
       
   389 
       
   390 
       
   391 #ifdef REQHANDLE_TIMER
       
   392         /**
       
   393          * Chooses the type of response, automatic or common
       
   394          *         
       
   395          *
       
   396          * @param aReqHandleType
       
   397          * @param aTsyReqHandle
       
   398          */
       
   399         void SetTypeOfResponse( const TInt aReqHandleType,
       
   400                                 const TTsyReqHandle aTsyReqHandle );
       
   401 #endif // REQHANDLE_TIMER
       
   402 
       
   403     private:
       
   404 
       
   405         /**
       
   406          * Pointer to CMmCustomTsy class
       
   407          * Not Own.         
       
   408          */
       
   409         CMmCustomTsy* iMmCustomTsy;
       
   410         
       
   411         /**
       
   412          *Pointer to request handle store
       
   413          * Own.         
       
   414          */
       
   415         CMmTsyReqHandleStore* iTsyReqHandleStore;
       
   416         
       
   417         /**
       
   418          * SIM Custom API request handle table
       
   419          * Own.         
       
   420          */
       
   421         TTsyReqHandle iSIMReqHandles[ESIMRequestTypeMaxNumOfRequests];
       
   422 
       
   423         /**
       
   424          * Saves temporarily last TSY request type
       
   425          * Own.         
       
   426          */
       
   427         TSIMRequestType iReqHandleType;
       
   428 
       
   429         /**
       
   430          * Pointer to VIAG Home Zone parameters structure
       
   431          * Not Own.         
       
   432          */
       
   433         RMmCustomAPI::TViagParams* iViagParams;
       
   434         
       
   435         /**
       
   436          * Pointer to VIAG Home Zone elements structure
       
   437          * Not Own.         
       
   438          */ 
       
   439         RMmCustomAPI::TViagElement* iViagElems;
       
   440 
       
   441         /**
       
   442          * VIAG home zone record content
       
   443          * Not Own.         
       
   444          */
       
   445         RMmCustomAPI::TViagCacheRecordContent* iViagReadCacheRecord;
       
   446 
       
   447         /**
       
   448          * Is VIAG home zone params requested before SIM is ready
       
   449          */
       
   450         TBool iViagParamsReadRequested;
       
   451         
       
   452         /**
       
   453          * used for handling SIM CB Topic browsing:
       
   454          * a cached table of all entries         
       
   455          * Own.         
       
   456          */
       
   457         CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* iSimCbTopics;
       
   458 
       
   459         /**
       
   460          * The index of the next topic to retrieve with the GetNext-method         
       
   461          */                
       
   462         TInt iGetNextSimCbTopicIndex;
       
   463 
       
   464         /**
       
   465          * The index of the topic to be deleted
       
   466          */        
       
   467         TInt iSimCbTopicIndexToBeDeleted;
       
   468 
       
   469         /**
       
   470          * The Dynamic cache for VIAG home zone records
       
   471          * Own.         
       
   472          */        
       
   473         CArrayFixFlat<RMmCustomAPI::TViagCacheRecordContent>* iViagDynamicCache;
       
   474 
       
   475         /**
       
   476          * Pointer to current cache
       
   477          * Not Own.         
       
   478          */        
       
   479         RMmCustomAPI::TViagCacheRecordId* iCurrentlyRetrievedCache;
       
   480         
       
   481         /**
       
   482          * Is ViagHomeZone cache ready
       
   483          */
       
   484         TBool iViagHomeZoneCacheReady;
       
   485         
       
   486         /** 
       
   487          * Used for queuing ReadViagHomeZoneCache requests 
       
   488          */
       
   489         struct TReadViagHomeZoneCacheRequest
       
   490 			   {
       
   491 			   /** ETel request handle */
       
   492 			   TTsyReqHandle iReqHandle; 
       
   493 			   /** pointer to client-side	data */
       
   494 			   RMmCustomAPI::TViagCacheRecordId* iViagRecordId;
       
   495                RMmCustomAPI::TViagCacheRecordContent* iViagRecordContent;
       
   496 			   };
       
   497         
       
   498         /**
       
   499 		 * Array for buffering ReadViagHomeZoneCache requests
       
   500 		 */		     
       
   501 		    RPointerArray< TReadViagHomeZoneCacheRequest > 
       
   502             iReadViagHomeZoneCacheRequests;
       
   503         
       
   504         
       
   505         
       
   506         
       
   507     };
       
   508 
       
   509 #endif      // CMMSIMTSY_H
       
   510 
       
   511 //  End of File