telephonyserverplugins/common_tsy/commontsy/inc/mmtsy/cmmlinetsy.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
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 CMMLINETSY_H
       
    21 #define CMMLINETSY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <et_tsy.h>
       
    25 #include <et_phone.h>
       
    26 #include <etelmm.h>
       
    27 #include <ctsy/tflogger.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CMmPhoneTsy;
       
    31 class CMmCallTsy;
       
    32 class CMmTsyReqHandleStore;
       
    33 class CMmMessageManagerBase;
       
    34 class CMmDataPackage;
       
    35 class MLtsyFactoryBase;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40  * CMmLineTsy implements mode independent Line based functionality (defined by
       
    41  * Symbian
       
    42  */
       
    43 NONSHARABLE_CLASS( CMmLineTsy ) : public CLineBase
       
    44     {
       
    45     public: // Enumerations
       
    46 
       
    47         /**Enumeration for request handle types*/
       
    48         enum TLineRequestTypes
       
    49             { 
       
    50             EMultimodeLineReqHandleUnknown, //0
       
    51             EMultimodeLineNotifyIncomingCall, 
       
    52             EMultimodeLineNotifyStatusChange,
       
    53             EMultimodeLineNotifyCallAdded,
       
    54             EMultimodeLineCapsChangeNotification,
       
    55             EMultimodeLineMobileLineStatusChange, //5
       
    56 
       
    57             // NOTE!: Declare constant for those requests that need
       
    58             // own request handle record in iTsyReqHandleStore above the
       
    59             // following!
       
    60             EMultimodeLineMaxNumOfRequests
       
    61             };
       
    62 
       
    63     public:  // Constructors and destructor
       
    64         
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CMmLineTsy();
       
    69 
       
    70         // New functions
       
    71         
       
    72         /**
       
    73          * This method is used for notifying a client about an incoming call.
       
    74          *          
       
    75          *
       
    76          * @param aDataPackage Package containing information about the 
       
    77          * incoming call
       
    78          */
       
    79         virtual void CompleteNotifyIncomingCall( 
       
    80             CMmDataPackage* aDataPackage ) = 0;
       
    81 
       
    82         /**
       
    83          * This method is used for notifying a line of a call entering 
       
    84          * Dialling state
       
    85          *          
       
    86          *
       
    87          * @param aDataPackage Package containing information about the call
       
    88          */
       
    89         virtual void CompleteNotifyDiallingStatus( 
       
    90             CMmDataPackage* aDataPackage ) = 0;
       
    91 
       
    92         /**
       
    93          * This method is used for notifying a client that a 
       
    94          * call has been added
       
    95          *          
       
    96          *
       
    97          * to the line.
       
    98          * @param aName Name of the call added to this line
       
    99          */
       
   100         void CompleteNotifyCallAdded( const TDesC& aName );
       
   101 
       
   102         /**
       
   103          * This method is used to notify a client about a line status change
       
   104          *          
       
   105          *
       
   106          */
       
   107         virtual void CompleteNotifyStatusChange();
       
   108 
       
   109         /**
       
   110          * Returns current line mode
       
   111          *          
       
   112          *
       
   113          * @return Line mode
       
   114          */
       
   115         RMobilePhone::TMobileService LineMode() const;
       
   116 
       
   117         /**
       
   118          * Returns current line name
       
   119          *          
       
   120          *
       
   121          * @return Line name
       
   122          */
       
   123         TName LineName() const;
       
   124 
       
   125         /**
       
   126          * Returns current line information
       
   127          *          
       
   128          *
       
   129          * @return Line information
       
   130          */
       
   131         RPhone::TLineInfo LineInfo() const;
       
   132 
       
   133         /**
       
   134          * Decrements counter containing information about the number of calls 
       
   135          * opened from this line
       
   136          *          
       
   137          *
       
   138          */
       
   139         void DecrementNumberOfCalls();
       
   140 
       
   141         /**
       
   142          * Notifies Line object about a new MO call that has been initiated
       
   143          * bypassing TSY
       
   144          *          
       
   145          *
       
   146          * @param aDataPackage Information about the call
       
   147          */
       
   148         void CompleteNotifyAddBypassingCall( CMmDataPackage* aDataPackage ); 
       
   149 
       
   150         // Functions from base classes
       
   151 
       
   152         /**
       
   153          * Dispatches Multimode API functions calls
       
   154          *          
       
   155          *
       
   156          * @param aTsyReqHandle TSY request handle
       
   157          * @param aIpc IPC number of the request
       
   158          * @param aPackage Packaged request parameters
       
   159          * @return Result of the request
       
   160          */
       
   161         TInt ExtFunc( 
       
   162                 const TTsyReqHandle aTsyReqHandle, 
       
   163                 const TInt aIpc, 
       
   164                 const TDataPackage& aPackage );
       
   165 
       
   166         /**
       
   167          * This function opens a requested line.
       
   168          *          
       
   169          *
       
   170          * @param aName Name of the call to be opened.
       
   171          * @return Call object that was opened.
       
   172          */
       
   173         CTelObject* OpenNewObjectByNameL( const TDesC& aName );
       
   174 
       
   175         /**
       
   176          * This function creates a new name for a call and opens a new call.
       
   177          *          
       
   178          * 
       
   179          * @param aName Name of the new call.
       
   180          * @return Call object that was opened.
       
   181          */
       
   182         virtual CTelObject* OpenNewObjectL( TDes& aNewName ) = 0;
       
   183 
       
   184         /**
       
   185          * Returns request mode for a given IPC.
       
   186          *          
       
   187          *
       
   188          * @param aIpc: IPC number
       
   189          * @return Request mode for the given IPC
       
   190          */
       
   191         CTelObject::TReqMode ReqModeL( const TInt aIpc );
       
   192         
       
   193         /**
       
   194          * Cancels request that's IPC number and request handle are given as
       
   195          * parameters
       
   196          *          
       
   197          *
       
   198          * @param aIpc IPC number of the cancelled request
       
   199          * @param aTsyReqHandle TSY request handle of the cancelled request
       
   200          * @return Result of the request
       
   201          */
       
   202         TInt CancelService( const TInt aIpc, 
       
   203             const TTsyReqHandle aTsyReqHandle );
       
   204         
       
   205         /**
       
   206          * Register a notification by IPC number.
       
   207          *          
       
   208          *
       
   209          * @param aIpc IPC number of the request.
       
   210          * @return Result of the request
       
   211          */
       
   212         TInt RegisterNotification( const TInt aIpc );
       
   213         
       
   214         /**
       
   215          * Deregisters a given notification
       
   216          *          
       
   217          *
       
   218          * @param aIpc IPC number of the request
       
   219          * @return Result of the request
       
   220          */
       
   221         TInt DeregisterNotification( const TInt aIpc );
       
   222         
       
   223         /**
       
   224          * Returns number of slots to be used for a given IPC
       
   225          *          
       
   226          *
       
   227          * @param aIpc IPC number of the request
       
   228          * @return Number of slots for the given IPC
       
   229          */
       
   230         TInt NumberOfSlotsL( const TInt aIpc );
       
   231 
       
   232         /**
       
   233          * Returns the number of calls opened from this line.
       
   234          *          
       
   235          *
       
   236          * @param aTsyReqHandle: TSY request handle
       
   237          * @param aCount: Number of calls opened from this line
       
   238          * @return Return value to the ETel Server
       
   239          */
       
   240         TInt EnumerateCall( const TTsyReqHandle aTsyReqHandle, 
       
   241             TInt* aCount );
       
   242         
       
   243         /**
       
   244          * This function retrieves the current line information.
       
   245          *          
       
   246          *
       
   247          * @param aTsyReqHandle TSY Request handle
       
   248          * @param aLineInfo Current line information
       
   249          * @return Return value to the ETel Server 
       
   250          */
       
   251         TInt GetInfo( const TTsyReqHandle aTsyReqHandle, 
       
   252             RLine::TLineInfo* aLineInfo );
       
   253 
       
   254         /**
       
   255          * This function retrieves the current line capabilities.
       
   256          *           
       
   257          *
       
   258          * @param aTsyReqHandle TSY request handle
       
   259          * @param aCaps Current line capabilities
       
   260          * @return Return value to the ETel Server
       
   261          */
       
   262         TInt GetCaps( const TTsyReqHandle aTsyReqHandle, 
       
   263             RLine::TCaps* aCaps );
       
   264 
       
   265         /**
       
   266          * This function returns core line status information.
       
   267          *          
       
   268          *
       
   269          * @param aTsyReqHandle TSY request handle
       
   270          * @param aStatus Current line status
       
   271          * @return Return value to the ETel Server
       
   272          */
       
   273         TInt GetStatus( const TTsyReqHandle aTsyReqHandle, 
       
   274             RCall::TStatus* aStatus );
       
   275 
       
   276         /**
       
   277          * This function returns information about a call.
       
   278          *          
       
   279          *
       
   280          * @param aTsyReqHandle TSY request handle
       
   281          * @param aCallInfo Call ínformation
       
   282          * @return Return value to the ETel Server
       
   283          */
       
   284         TInt GetCallInfo( 
       
   285                 const TTsyReqHandle aTsyReqHandle, 
       
   286                 TCallInfoIndex* aCallInfo );
       
   287 
       
   288         /**
       
   289          * Used for subscribing a notification in a line status change.
       
   290          *          
       
   291          *
       
   292          * @param aTsyReqHandle TSY request handle
       
   293          * @param aLineStatus New status of this line
       
   294          * @return Return value to the ETel Server
       
   295          */
       
   296         TInt NotifyStatusChange( const TTsyReqHandle aTsyReqHandle,
       
   297             RCall::TStatus* aLineStatus );
       
   298         
       
   299         /**
       
   300          * Cancels line status notifications.
       
   301          *          
       
   302          *
       
   303          * @param aTsyReqHandle TSY request handle
       
   304          * @return Return value to the ETel Server
       
   305          */
       
   306         TInt NotifyStatusChangeCancel( 
       
   307             const TTsyReqHandle aTsyReqHandle );
       
   308 
       
   309         /**
       
   310          * This method retrieves the current hook status.
       
   311          *          
       
   312          *
       
   313          * @param aTsyReqHandle TSY request handle
       
   314          * @param aHookStatus Hook status
       
   315          * @return Return value to the ETel Server
       
   316          */        
       
   317         TInt GetHookStatus( const TTsyReqHandle aTsyReqHandle,
       
   318             RCall::THookStatus* /*aHookStatus*/ );
       
   319         
       
   320         /**
       
   321          * Notify when hook status has changed
       
   322          *          
       
   323          *
       
   324          * @param aTsyReqHandle TSY request handle
       
   325          * @param aHookStatus Hook status
       
   326          * @return Return value to the ETel Server
       
   327          */
       
   328         TInt NotifyHookChange( const TTsyReqHandle aTsyReqHandle,
       
   329             RCall::THookStatus* /*aHookStatus*/ );
       
   330         
       
   331         /**
       
   332          * Cancels hook status change notifications
       
   333          *          
       
   334          *
       
   335          * @param aTsyReqHandle TSY request handle
       
   336          * @return Return value to the ETel Server
       
   337          */
       
   338         TInt NotifyHookChangeCancel( 
       
   339             const TTsyReqHandle aTsyReqHandle );
       
   340 
       
   341         /**
       
   342          * This method provides notification of a change in the line 
       
   343          * capabilities.
       
   344          *          
       
   345          *
       
   346          * @param aTsyReqHandle TSY request handle
       
   347          * @param aCaps New capabilities of this line
       
   348          * @return Return value to the ETel Server
       
   349          */
       
   350         TInt NotifyCapsChange( const TTsyReqHandle aTsyReqHandle, 
       
   351             RLine::TCaps* aCaps );
       
   352         
       
   353         /**
       
   354          * This method cancels line capabilities change notification 
       
   355          * request.
       
   356          *          
       
   357          *
       
   358          * @param aTsyReqHandle TSY request handle
       
   359          * @return Return value to the ETel Server
       
   360          */
       
   361         TInt NotifyCapsChangeCancel( 
       
   362             const TTsyReqHandle aTsyReqHandle );
       
   363         
       
   364         /**
       
   365          * This method is used for notifyinf a client when an incoming call is 
       
   366          * detected.
       
   367          *          
       
   368          *
       
   369          * @param aTsyReqHandle TSY request handle
       
   370          * @param aName Name of the incoming call
       
   371          * @return Return value to the ETel Server
       
   372          */
       
   373         virtual TInt NotifyIncomingCall( const TTsyReqHandle aTsyReqHandle,
       
   374             TName* aName );
       
   375         
       
   376         /**
       
   377          * This method cancels an outstanding incoming call notification.
       
   378          *          
       
   379          *
       
   380          * @param aTsyReqHandle TSY request handle
       
   381          * @return Return value to the ETel Server
       
   382          */
       
   383         TInt NotifyIncomingCallCancel( 
       
   384             const TTsyReqHandle aTsyReqHandle );
       
   385         
       
   386         /**
       
   387          * This method provides a notification that a new call has been added to
       
   388          * the line.
       
   389          *
       
   390          * @param aTsyReqHandle TSY request handle
       
   391          * @param aName The name of the added call
       
   392          * @return Return value to the ETel Server
       
   393          */
       
   394         TInt NotifyCallAdded( const TTsyReqHandle aTsyReqHandle, 
       
   395             TName* aName );
       
   396         
       
   397         /**
       
   398          * This method cancels an outstanding new call added notification 
       
   399          * request.
       
   400          *          
       
   401          *
       
   402          * @param aTsyReqHandle TSY request handle
       
   403          * @return Return value to the ETel Server
       
   404          */
       
   405         TInt NotifyCallAddedCancel( const TTsyReqHandle aTsyReqHandle );
       
   406 
       
   407 #ifdef TF_LOGGING_ENABLED     
       
   408    
       
   409         /**
       
   410          * Overloads original ReqCompleted for logging purposes
       
   411          *          
       
   412          *
       
   413          * @param aTsyReqHandle TSY request handle
       
   414          * @param aError Result
       
   415          */
       
   416         virtual void ReqCompleted(const TTsyReqHandle aTsyReqHandle,
       
   417             const TInt aError);
       
   418 #endif
       
   419 
       
   420     protected:  // Constructors and destructor
       
   421 
       
   422         /**
       
   423          * C++ default constructor.
       
   424          */
       
   425         CMmLineTsy();
       
   426 
       
   427         /**
       
   428          * By default Symbian 2nd phase constructor is private.
       
   429          */
       
   430         void ConstructL();
       
   431 
       
   432         // New functions
       
   433 
       
   434         /**
       
   435          * Returns the current status of the line
       
   436          *          
       
   437          *
       
   438          * @param aTsyReqHandle TSY request handle
       
   439          * @param aStatus Mobile line status
       
   440          * @return Return value to the ETel Server
       
   441          */
       
   442         TInt GetMobileLineStatus( const TTsyReqHandle aTsyReqHandle,
       
   443             RMobileCall::TMobileCallStatus* aStatus );
       
   444         
       
   445         /**
       
   446          * Allows a client to be notified when the mobile line changes state.
       
   447          *          
       
   448          *
       
   449          * @param aStatus New mobile status of a line
       
   450          * @return Return value to the ETel Server
       
   451          */
       
   452         TInt NotifyMobileLineStatusChange( 
       
   453             RMobileCall::TMobileCallStatus* aStatus );
       
   454         
       
   455         /**
       
   456          * Cancels an outstanding asynchronous NotifyMobileLineStatusChange 
       
   457          * request.
       
   458          *          
       
   459          *
       
   460          * @param aTsyReqHandle TSY request handle
       
   461          * @return Return value to the ETel Server
       
   462          */
       
   463         TInt NotifyMobileLineStatusChangeCancel( 
       
   464             const TTsyReqHandle aTsyReqHandle );
       
   465 
       
   466         /**
       
   467          * Handles extended client requests. 
       
   468          *          
       
   469          *
       
   470          * @param aTsyReqHandle TSY request handle
       
   471          * @param aIpc IPC number of the request
       
   472          * @param aPackage Packaged request parameters
       
   473          * @return Result of the request
       
   474          */
       
   475         TInt DoExtFuncL( const TTsyReqHandle aTsyReqHandle, const TInt aIpc, 
       
   476             const TDataPackage& aPackage );
       
   477 
       
   478         /**
       
   479          * Creates a call object for the call that has been initiated bypassing 
       
   480          * TSY
       
   481          *          
       
   482          *
       
   483          * @param aCallId: Call id of the new call
       
   484          * @param aCallMode: Call mode
       
   485          * @param aCallStatus: Call status
       
   486          * @return Pointer to created call object
       
   487          */
       
   488         virtual CMmCallTsy* CreateGhostCallObject(
       
   489             TInt aCallId,
       
   490             RMobilePhone::TMobileService aCallMode,
       
   491             RMobileCall::TMobileCallStatus aCallStatus ) = 0;
       
   492 
       
   493         /**
       
   494          * Initialises miscellaneous internal attributes
       
   495          *          
       
   496          *
       
   497          */
       
   498         virtual void InitInternalAttributesL();
       
   499 
       
   500         /**
       
   501          * Returns the preallocated Call object for incoming call or creates a 
       
   502          * new one
       
   503          *          
       
   504          *
       
   505          * @return Pointer to the call object for incoming call
       
   506          */
       
   507         CMmCallTsy* CallObjectForIncomingCall();
       
   508 
       
   509         /**
       
   510          * Creates and stores a Call object for incoming call
       
   511          *          
       
   512          *
       
   513          * @return TInt Success/failure value
       
   514          */
       
   515         virtual TInt CreateCallObjectForIncomingCall() = 0;
       
   516         
       
   517         /**
       
   518          * Creates a new name for a call.
       
   519          *          
       
   520          *
       
   521          * @param aNewName On return contains the new call name
       
   522          * @return Success/failure value
       
   523          */
       
   524         TInt CreateNewCallName( TDes& aNewName );
       
   525         
       
   526         /**
       
   527          * Returns the sequence number of the call created from this line.
       
   528          *          
       
   529          *
       
   530          * @return Sequence number of calls after incrementing.
       
   531          */
       
   532         TUint IncrementCallSequenceNumber();
       
   533         
       
   534         /**
       
   535          * This method is used for notifying a client about the capabilities 
       
   536          * change.
       
   537          *          
       
   538          *
       
   539          */
       
   540         void CompleteNotifyCapsChange();
       
   541 
       
   542     protected:  // Data
       
   543 
       
   544         /**
       
   545          * A pointer to the multimode phone object.        
       
   546          */                 
       
   547         CMmPhoneTsy* iMmPhone;
       
   548 
       
   549         /**
       
   550          * A table for line request handles
       
   551          */         
       
   552         TTsyReqHandle iLineReqHandles[EMultimodeLineMaxNumOfRequests];
       
   553 
       
   554         /**
       
   555          * Pointer to request handle store
       
   556          * Own.
       
   557          */                  
       
   558         CMmTsyReqHandleStore* iTsyReqHandleStore;
       
   559 
       
   560         /**
       
   561          * Line request handle type
       
   562          */         
       
   563         TLineRequestTypes iReqHandleType;
       
   564 
       
   565         /**
       
   566          * Pointer to the call object reserved for incoming call
       
   567          */                  
       
   568         CMmCallTsy* iCallForIncomingCall;
       
   569         
       
   570         /**
       
   571          * Current core line status
       
   572          */         
       
   573         RCall::TStatus iLineStatus;
       
   574         
       
   575         /**
       
   576          * Current Mobile line status
       
   577          */         
       
   578         RMobileCall::TMobileCallStatus iMobileLineStatus;
       
   579 
       
   580         /**
       
   581          * Current line capabilities
       
   582          */         
       
   583         RLine::TCaps iLineCaps;
       
   584         
       
   585         /**
       
   586          * Current number of calls opened from this line
       
   587          */         
       
   588         TInt iNumCalls;
       
   589         
       
   590         /**
       
   591          * Name of this line
       
   592          */         
       
   593         TName iLineName;
       
   594         
       
   595         /**
       
   596          * Sequence number given for a new call
       
   597          */         
       
   598         TUint iCallSequenceNumber;
       
   599         
       
   600         /**
       
   601          * The name of the last call opened from this line
       
   602          */         
       
   603         TName iNameOfLastCallAdded;
       
   604 
       
   605         /**
       
   606          * The name of the incoming call to be opened from this line
       
   607          */         
       
   608         TName iNameOfCallForAnswering;
       
   609 
       
   610         /**
       
   611          * Line status pointer (pointing to ETel server's address space)
       
   612          */                  
       
   613         RCall::TStatus* iRetLineStatus;
       
   614         
       
   615         /**
       
   616          * Line capabilities pointer (pointing to ETel server's address space)
       
   617          */                  
       
   618         RLine::TCaps* iRetCaps;
       
   619         
       
   620         /**
       
   621          * Incoming call name pointer 
       
   622          * (pointing to ETel server's address space)
       
   623          */                   
       
   624         TName* iRetIncomingCallName;
       
   625         
       
   626         /**
       
   627          * Pointer to the name of the last call added (pointing to ETel  
       
   628          * server's address space)
       
   629          */                  
       
   630         TName* iRetCallAdded;    
       
   631         
       
   632         /**
       
   633          * Pointer to the mobile status (pointing to ETel server's address 
       
   634          * space)
       
   635          */                  
       
   636         RMobileCall::TMobileCallStatus* iRetMobileLineStatus;
       
   637            
       
   638         /**
       
   639          * Pointer to the message manager
       
   640          */                  
       
   641         CMmMessageManagerBase* iMessageManager;
       
   642 
       
   643 	    /**
       
   644 	     * Line Mode
       
   645 	     */         		
       
   646 	    RMobilePhone::TMobileService iLineMode;
       
   647 	       
       
   648     };
       
   649 
       
   650 #endif      // CMMLINETSY_H   
       
   651             
       
   652 // End of File
       
   653 
       
   654 
       
   655 
       
   656 
       
   657         
       
   658         
       
   659         
       
   660 
       
   661         
       
   662 
       
   663         
       
   664 
       
   665 
       
   666 
       
   667