telephonyserverplugins/common_tsy/commontsy/inc/mmsms/cmmussdtsy.h
changeset 0 3553901f7fa8
child 7 fe8b59ab9fa0
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 CMMUSSDTSY_H
       
    21 #define CMMUSSDTSY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <et_phone.h>               // CSubSessionExtBase 
       
    25 #include "cmmphonetsy.h"    
       
    26 
       
    27 //  FORWARD DECLARATIONS
       
    28 class CMmPhoneTsy;
       
    29 class CMessStore;
       
    30 class RMobileUssdMessaging::TMobileUssdAttributesV1;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35 *  USSD TSY
       
    36 */
       
    37 NONSHARABLE_CLASS( CMmUssdTsy ) : public CSubSessionExtBase
       
    38     {
       
    39     public:
       
    40     
       
    41         enum TUssdRequestTypes
       
    42             {
       
    43             EMultimodeUssdReqHandleUnknown,
       
    44             EMultimodeUssdSendMessage,
       
    45             EMultimodeUssdReceiveMessage,
       
    46             EMultimodeUssdSendRelease,
       
    47             EMultimodeUssdNotifyNetworkRelease,            
       
    48             EMultimodeUssdSendMessageNoFdnCheck,
       
    49             // ATTENTION: Declare constant for those requests that need
       
    50             // own request handle record in iTsyReqHandleStore above the
       
    51             // following!
       
    52             EMultimodeUssdMaxNumOfRequests
       
    53             };
       
    54         
       
    55     public:
       
    56 
       
    57         /**
       
    58          * Two-phased constructor.
       
    59          */
       
    60         static CMmUssdTsy* NewL( CMmPhoneTsy* aMmPhone );
       
    61 
       
    62         /** 
       
    63          * Destructor.
       
    64          */
       
    65         virtual ~CMmUssdTsy();
       
    66 
       
    67         /**
       
    68          * Initialisation method
       
    69          *          
       
    70          * 
       
    71          */
       
    72         virtual void Init();
       
    73 
       
    74         /**
       
    75          * Returns number of slots to be used for given IPC
       
    76          *          
       
    77          * 
       
    78          * @param aIpc Request IPC number
       
    79          * @return Number of slots to be used
       
    80          */
       
    81         virtual TInt NumberOfSlotsL( const TInt aIpc );
       
    82     
       
    83         /**
       
    84          * Register given notification
       
    85          *          
       
    86          * 
       
    87          * @param aIpc Request IPC number
       
    88          * @return Result of the request
       
    89          */
       
    90         virtual TInt RegisterNotification( const TInt aIpc );
       
    91 
       
    92         /**
       
    93          * Deregister given notification
       
    94          *          
       
    95          * 
       
    96          * @param aIpc Request IPC number
       
    97          * @return Result of the request
       
    98          */
       
    99         virtual TInt DeregisterNotification( const TInt aIpc );
       
   100 
       
   101         /**
       
   102          * Dispatches multimode API function calls
       
   103          *          
       
   104          * 
       
   105          * @param aTsyReqHandle Request handle from ETel server
       
   106          * @param aIpc IPC number of the request
       
   107          * @param aPackage Reference to the input parameters.
       
   108          * @return KErrNone / KErrNotSupported
       
   109          */
       
   110         virtual TInt ExtFunc( const TTsyReqHandle aTsyReqHandle, 
       
   111             const TInt aIpc,
       
   112             const TDataPackage& aPackage );
       
   113 
       
   114         /**
       
   115          * Called by the server when it has a "extended".i.e. 
       
   116          * non-core ETel request for the TSY. To process a request handle, 
       
   117          * request type and request data are passed to the TSY. 
       
   118          *          
       
   119          * 
       
   120          * @param aTsyReqHandle Request handle from ETel server
       
   121          * @param aIpc IPC number of the request
       
   122          * @param aPackage Reference to the input parameters.
       
   123          * @return KErrNone / KErrNotSupported
       
   124          */
       
   125         virtual TInt DoExtFuncL( const TTsyReqHandle aTsyReqHandle, 
       
   126             const TInt aIpc, 
       
   127             const TDataPackage& aPackage );
       
   128 
       
   129         /**
       
   130          * Returns request mode for given IPC number
       
   131          *          
       
   132          * 
       
   133          * @param aIpc Request IPC number
       
   134          * @return Request mode
       
   135          */
       
   136         virtual CTelObject::TReqMode ReqModeL( const TInt aIpc );
       
   137 
       
   138         /**
       
   139          * Cancels request that's IPC number and request handle are given in
       
   140          *          
       
   141          * 
       
   142          * @param aIpc Request IPC number
       
   143          * @param aTsyReqHandle Request handle from ETel server
       
   144          * @return Error value
       
   145          */
       
   146         virtual TInt CancelService( const TInt aIpc, 
       
   147             const TTsyReqHandle aTsyReqHandle );
       
   148 
       
   149         /**
       
   150          * Opens new object and names it
       
   151          *          
       
   152          * 
       
   153          * @param aName Return contains name of opened object
       
   154          * @return Pointer to created object casted to CTelObject*
       
   155          */
       
   156         virtual CTelObject* OpenNewObjectL( TDes& aName );
       
   157 
       
   158         /**
       
   159          * Opens a object using given name
       
   160          *          
       
   161          * 
       
   162          * @param aName On return contains name of opened object
       
   163          * @return NULL
       
   164          */
       
   165         virtual CTelObject* OpenNewObjectByNameL( const TDesC& aName );
       
   166     
       
   167         /**
       
   168          * Complete SendMessage
       
   169          *          
       
   170          * 
       
   171          * @param aError Completes send message request
       
   172          */
       
   173         virtual void CompleteSendMessage( TInt aError );
       
   174 
       
   175         /**
       
   176          * Complete SendMessageNoFdnCheck
       
   177          *          
       
   178          * 
       
   179          * @param aError Completes send message request
       
   180          */
       
   181         virtual void CompleteSendMessageNoFdnCheck( TInt aError );
       
   182                   
       
   183         /**
       
   184          * Complete SendRelease
       
   185          *          
       
   186          * 
       
   187          * @param aError Error code
       
   188          * @param aDataPackage Contains packed 
       
   189          * RMobilePhone::TMobilePhoneSendSSRequestV3
       
   190          */
       
   191         virtual void CompleteSendRelease( TInt aError, 
       
   192             CMmDataPackage* aDataPackage );
       
   193     
       
   194         /**
       
   195          * Complete ReceiveMessage request
       
   196          *          
       
   197          * 
       
   198          * @param aError Error code
       
   199          * @param aDataPackage Contains TDesC8& (USSD string data) and 
       
   200          * packed RMobilePhone::TMobileUssdAttributesV1
       
   201          */
       
   202         virtual void CompleteReceiveMessage( TInt aError, 
       
   203             CMmDataPackage* aDataPackage );
       
   204             
       
   205         /**
       
   206          * Notification network release
       
   207          *           
       
   208          *
       
   209          * @param aTsyReqHandle Request handle
       
   210          * @param aMsgData Contains packed RMobileUssdMessaging::TMobilePhoneSendSSRequestV3
       
   211          * @param aMsgAttributes Contains poacked RMobilePhone::TMobileUssdAttributesV1
       
   212          * @return Error value
       
   213          */
       
   214         virtual TInt NotifyNetworkRelease( const TTsyReqHandle aTsyReqHandle, 
       
   215             TDes8* aMsgData,
       
   216             TDes8* aMsgAttributes);
       
   217         
       
   218         /**
       
   219          * Complete network release request
       
   220          *          
       
   221          *
       
   222          * @param aError Error code
       
   223          * @param aDataPackage Contains TDesC8& (USSD string data) and 
       
   224          * packed RMobilePhone::TMobileUssdAttributesV1
       
   225          */    
       
   226         virtual void CompleteNotifyNetworkRelease( TInt aErrorCode, 
       
   227             CMmDataPackage* aDataPackage );
       
   228         
       
   229         /**
       
   230          * Notify network release cancel
       
   231          *          
       
   232          *
       
   233          * @return KErrNone
       
   234          */    
       
   235         virtual TInt NotifyNetworkReleaseCancel();                
       
   236 
       
   237 #ifdef REQHANDLE_TIMER
       
   238         /**
       
   239          * Calls the needed complete method due timer expiration
       
   240          *          
       
   241          * 
       
   242          * @param aReqHandleType Req handle type.
       
   243          * @param aError Error value
       
   244          */
       
   245         virtual void Complete( TInt aReqHandleType, 
       
   246             TInt aError );
       
   247 #endif // REQHANDLE_TIMER
       
   248 
       
   249         /**
       
   250          * Returns pointer to the Phone object
       
   251          *          
       
   252          * 
       
   253          * @return Pointer to the Phone object
       
   254          */
       
   255         virtual CMmPhoneTsy* Phone();
       
   256         
       
   257     private:
       
   258 
       
   259         /**
       
   260          * C++ default constructor.
       
   261          */
       
   262         CMmUssdTsy();
       
   263 
       
   264         /**
       
   265          * By default Symbian 2nd phase constructor is private.
       
   266          * @param CMmPhoneTsy* aMmPhoneTsy, pointer to phone tsy object.
       
   267          */
       
   268         void ConstructL( CMmPhoneTsy* aMmPhoneTsy );
       
   269 
       
   270         /**
       
   271          * Returns the ussd messaging capabilities to the client
       
   272          *          
       
   273          * 
       
   274          * @param aTsyReqHandle Request handle
       
   275          * @param aCaps Packaged RMobilePhone::TMobileUssdCapsV1
       
   276          * @return Return value to the ETel Server
       
   277          */ 
       
   278         TInt GetCaps( const TTsyReqHandle aTsyReqHandle, 
       
   279             TDes8* aCaps );
       
   280 
       
   281         /**
       
   282          * Receive ussd message
       
   283          *          
       
   284          * 
       
   285          * @param aTsyReqHandle Request handle
       
   286          * @param aMsgData Message data
       
   287          * @param aMsgAttributes Message attributes
       
   288          * @return Error value
       
   289          */ 
       
   290         TInt ReceiveMessage( const TTsyReqHandle aTsyReqHandle, 
       
   291             TDes8* aMsgData, 
       
   292             TDes8* aMsgAttributes );
       
   293     
       
   294         /**
       
   295          * Receive ussd message cancel
       
   296          *          
       
   297          * 
       
   298          * @param aTsyReqHandle Request handle
       
   299          */
       
   300         void ReceiveMessageCancel( const TTsyReqHandle aTsyReqHandle );
       
   301 
       
   302         /**
       
   303          * Send ussd message
       
   304          *          
       
   305          * 
       
   306          * @param aTsyReqHandle Request handle
       
   307          * @param aData Message data
       
   308          * @param aAttributes Contains packaged
       
   309          * RMobileUssdMessaging::TMobileUssdAttributesV1Pckg
       
   310          * @return Error value
       
   311          */ 
       
   312         TInt SendMessageL( const TTsyReqHandle aTsyReqHandle, 
       
   313             TDes8* aData, 
       
   314             TDes8* aAttributes );
       
   315             
       
   316         /**
       
   317          * Cancels an outstanding SendMessage request
       
   318          *          
       
   319          * 
       
   320          * @param aTsyReqHandle Request handle
       
   321          * @return KErrNone
       
   322          */
       
   323         TInt SendMessageCancel( const TTsyReqHandle aTsyReqHandle );
       
   324               
       
   325         /** 
       
   326          * Cancels an outstanding SendMessageNoFdnCheck request
       
   327          *          
       
   328          * 
       
   329          * @param aTsyReqHandle Request handle
       
   330          * @return KErrNone
       
   331          */
       
   332         TInt SendMessageNoFdnCheckCancel( const TTsyReqHandle aTsyReqHandle );
       
   333 
       
   334         /**
       
   335          * Send ussd session end -message
       
   336          *          
       
   337          * 
       
   338          * @param aTsyReqHandle Request handle
       
   339          * @param aReturnResult Contains packed 
       
   340          * RMobileUssdMessaging::TMobilePhoneSendSSRequestV3
       
   341          * @return Error value
       
   342          */ 
       
   343         TInt SendReleaseL( const TTsyReqHandle aTsyReqHandle, 
       
   344             TDes8* aReturnResult );
       
   345 
       
   346         /**
       
   347          * Cancels an outstanding SendRelease request
       
   348          *          
       
   349          * 
       
   350          * @return KErrNone
       
   351          */
       
   352         TInt SendReleaseCancel();
       
   353 
       
   354         /**
       
   355          * Reset used member variables
       
   356          * 
       
   357          */
       
   358         void ResetVariables();
       
   359 
       
   360         /**
       
   361          * Checks whether or not a ETel request can be performed while offline 
       
   362          * mode is enabled
       
   363          *          
       
   364          * 
       
   365          * @param aIpc Ipc number of the request
       
   366          * @return TBool 
       
   367          */
       
   368         TBool IsRequestPossibleInOffline( TInt aIpc ) const;
       
   369 
       
   370 #ifdef REQHANDLE_TIMER
       
   371         /**
       
   372          * Chooses the type of response, automatic or common
       
   373          *          
       
   374          * 
       
   375          * @param aReqHandleType Req handle type.
       
   376          * @param aTsyReqHandle Eeq handle to be stored.
       
   377          */
       
   378         void SetTypeOfResponse(
       
   379             const TInt aReqHandleType, 
       
   380             const TTsyReqHandle aTsyReqHandle );
       
   381 #endif // REQHANDLE_TIMER
       
   382 
       
   383 #ifdef TF_LOGGING_ENABLED       
       
   384         /**
       
   385          * Overloads original ReqCompleted for logging purposes
       
   386          *          
       
   387          * 
       
   388          * @param aTsyReqHandle
       
   389          * @param aError
       
   390          */
       
   391         virtual void ReqCompleted(
       
   392             const TTsyReqHandle aTsyReqHandle,
       
   393             const TInt aError );
       
   394 #endif // TF_LOGGING_ENABLED
       
   395 
       
   396     /**
       
   397      * A table for call request handles
       
   398      */
       
   399     TTsyReqHandle iUssdReqHandles[EMultimodeUssdMaxNumOfRequests];
       
   400 
       
   401     /**
       
   402      * Pointer to request handle store
       
   403      * Own.     
       
   404      */
       
   405     CMmTsyReqHandleStore* iTsyReqHandleStore;
       
   406 
       
   407     /**
       
   408      * Request handle type
       
   409      */        
       
   410     TUssdRequestTypes iReqHandleType;
       
   411 
       
   412     /**
       
   413      * A pointer iReceiveUssdMessagePtr
       
   414      * Not own.     
       
   415      */        
       
   416     TDes8* iReceiveUssdMessagePtr;
       
   417 
       
   418     /**
       
   419      * A pointer to packed ussd message attributes
       
   420      * Not own.     
       
   421      */        
       
   422     RMobileUssdMessaging::TMobileUssdAttributesV1* 
       
   423         iReceiveUssdMessageAttributesPtr;
       
   424 
       
   425     /**
       
   426      * A pointer to packed operation code and additional info
       
   427      * Not own.     
       
   428      */        
       
   429     RMobilePhone::TMobilePhoneSendSSRequestV3* iReturnResultPtr;
       
   430 
       
   431     /**
       
   432      * A pointer to packed operation code and additional info
       
   433      * Not own.     
       
   434      */        
       
   435     RMobilePhone::TMobilePhoneSendSSRequestV3* iReturnNotifyPtr;
       
   436 
       
   437     /**
       
   438      * A pointer to packed attributes of a USSD message, returned in
       
   439      * NotifyNetworkRelease notifications
       
   440      * Not own.     
       
   441      */      
       
   442     RMobileUssdMessaging::TMobileUssdAttributesV1* iReturnNotifyUssdMessageAttributesPtr;
       
   443     
       
   444     /**
       
   445      * A pointer to the Phone TSY
       
   446      * Not own.     
       
   447      */        
       
   448     CMmPhoneTsy* iMmPhone;
       
   449 
       
   450     /**
       
   451      * Flow control is removed from EMobileUssdMessagingSendMessage.
       
   452      * iSsTransactionOngoing flag is used instead.     
       
   453      */  
       
   454     TBool iSsTransactionOngoing;
       
   455     
       
   456     /** 
       
   457      * Indicating status of NoFdnCheck
       
   458      */ 
       
   459     enum TUssdNoFdnCheckStatus
       
   460             {
       
   461             EUssdNoFdnCheckUnknown, 
       
   462             EUssdNoFdnCheckUsed,
       
   463             EUssdNoFdnCheckNotUsed                      
       
   464             }; 
       
   465 
       
   466     /** 
       
   467      * Indicating if SendMessageNoFdnCheck request is ongoing                         
       
   468      */ 
       
   469     TUssdNoFdnCheckStatus iUssdNoFdnCheckFlag;
       
   470 };
       
   471 
       
   472 #endif  // CMMUSSDTSY_H
       
   473 
       
   474 //  End of File
       
   475