telephonyserverplugins/ctsydispatchlayer/inc/ccallcontroldispatcher.h
changeset 0 3553901f7fa8
child 14 7ef16719d8cb
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalAll 
       
    19 */
       
    20 
       
    21 #ifndef __CCALLCONTROLDISPATCHER_H_
       
    22 #define __CCALLCONTROLDISPATCHER_H_
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32std.h>
       
    26 #include <e32base.h>
       
    27 #include <e32def.h>
       
    28 #include <etelmm.h>
       
    29 #include <ctsy/rmmcustomapi.h>
       
    30 
       
    31 #include <ctsy/ltsy/mltsydispatchfactory.h>
       
    32 
       
    33 
       
    34 #include "requestqueueoneshot.h"
       
    35 #include <ctsy/ltsy/ltsylogger.h>
       
    36 #include "mdispatchercallback.h"
       
    37 
       
    38 // CONSTANTS
       
    39 const TInt KInvalidCallId = -1;
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class CMmDataPackage;
       
    43 class MmMessageManagerCallback;
       
    44 class TDispatcherHolder;
       
    45 
       
    46 class MLtsyDispatchCallControlAnswer;
       
    47 class MLtsyDispatchCallControlHold;
       
    48 class MLtsyDispatchCallControlDialEmergency;
       
    49 class MLtsyDispatchCallControlStopDtmfTone;
       
    50 class MLtsyDispatchCallControlSetActiveAlsLine;
       
    51 class MLtsyDispatchCallControlSendDtmfTonesCancel;
       
    52 class MLtsyDispatchCallControlHangUp;
       
    53 class MLtsyDispatchCallControlResume;
       
    54 class MLtsyDispatchCallControlSetDynamicHscsdParams;
       
    55 class MLtsyDispatchCallControlDialVoice;
       
    56 class MLtsyDispatchCallControlTransfer;
       
    57 class MLtsyDispatchCallControlSendDtmfTones;
       
    58 class MLtsyDispatchCallControlGetIdentityServiceStatus;
       
    59 class MLtsyDispatchCallControlSwap;
       
    60 class MLtsyDispatchCallControlLoanDataPort;
       
    61 class MLtsyDispatchCallControlRecoverDataPort;
       
    62 class MLtsyDispatchCallControlStartDtmfTone;
       
    63 class MLtsyDispatchCallControlGetActiveAlsLine;
       
    64 class MLtsyDispatchCallControlDialData;
       
    65 class MLtsyDispatchCallControlQueryIsEmergencyNumber;
       
    66 class MLtsyDispatchCallControlGetAlsPpSupport;
       
    67 class MLtsyDispatchCallControlGetAlsBlockedStatus;
       
    68 class MLtsyDispatchCallControlSetAlsBlocked;
       
    69 class MLtsyDispatchCallControlGetLifeTime;
       
    70 class MLtsyDispatchCallControlTerminateErrorCall;
       
    71 class MLtsyDispatchCallControlTerminateAllCalls;
       
    72 class MLtsyDispatchCallControlGetCallForwardingIndicator;
       
    73 class MLtsyDispatchCallControlUpdateLifeTimer;
       
    74 
       
    75 // CLASS DECLARATION
       
    76 
       
    77 /**
       
    78  * This class is responsible for packing and unpacking data belonging
       
    79  * to CallControl related requests to the Licensee LTSY.
       
    80  */
       
    81 class CCallControlDispatcher : public CBase, public MDispatcherCallback
       
    82 	{
       
    83 public:
       
    84 
       
    85 	virtual ~CCallControlDispatcher();
       
    86 
       
    87 	static CCallControlDispatcher* NewL(
       
    88 			MLtsyDispatchFactoryV1& aLtsyFactory,
       
    89 			MmMessageManagerCallback& aMessageManagerCallback,
       
    90 			CRequestQueueOneShot& aRequestAsyncOneShot);
       
    91 
       
    92 	static CCallControlDispatcher* NewLC(
       
    93 			MLtsyDispatchFactoryV1& aLtsyFactory,
       
    94 			MmMessageManagerCallback& aMessageManagerCallback,
       
    95 			CRequestQueueOneShot& aRequestAsyncOneShot);
       
    96 
       
    97 	// Dispatcher functions for dispatching requests DOWN to the Licensee LTSY
       
    98 
       
    99 	TInt DispatchAnswerL(const CMmDataPackage* aDataPackage);
       
   100 	TInt DispatchAnswerIsvL(const CMmDataPackage* aDataPackage);
       
   101 	TInt DispatchHoldL(const CMmDataPackage* aDataPackage);
       
   102 	TInt DispatchDialEmergencyL(const CMmDataPackage* aDataPackage);
       
   103 	TInt DispatchDialNoFdnCheckL(const CMmDataPackage* aDataPackage);
       
   104 	TInt DispatchStopDtmfToneL(const CMmDataPackage* aDataPackage);
       
   105 	TInt DispatchDialIsvL(const CMmDataPackage* aDataPackage);
       
   106 	TInt DispatchSetActiveAlsLineL(const CMmDataPackage* aDataPackage);
       
   107 	TInt DispatchSendDtmfTonesCancelL(const CMmDataPackage* aDataPackage);
       
   108 	TInt DispatchHangUpL(const CMmDataPackage* aDataPackage);
       
   109 	TInt DispatchResumeL(const CMmDataPackage* aDataPackage);
       
   110 	TInt DispatchSetDynamicHscsdParamsL(const CMmDataPackage* aDataPackage);
       
   111 	TInt DispatchDialL(const CMmDataPackage* aDataPackage);
       
   112 	TInt DispatchTransferL(const CMmDataPackage* aDataPackage);
       
   113 	TInt DispatchSendDtmfTonesL(const CMmDataPackage* aDataPackage);
       
   114 	TInt DispatchGetIdentityServiceStatusL(const CMmDataPackage* aDataPackage);
       
   115 	TInt DispatchSwapL(const CMmDataPackage* aDataPackage);
       
   116 	TInt DispatchContinueDtmfStringSendingL(const CMmDataPackage* aDataPackage);
       
   117 	TInt DispatchLoanDataPortL(const CMmDataPackage* aDataPackage);
       
   118 	TInt DispatchRecoverDataPortL(const CMmDataPackage* aDataPackage);
       
   119 	TInt DispatchStartDtmfToneL(const CMmDataPackage* aDataPackage);
       
   120 	TInt DispatchGetActiveAlsLineL();
       
   121 	TInt DispatchQueryIsEmergencyNumberL(const CMmDataPackage* aDataPackage);
       
   122     TInt DispatchGetAlsPpSupportL();
       
   123     TInt DispatchGetAlsBlockedStatusL();
       
   124     TInt DispatchSetAlsBlockedL(const CMmDataPackage* aDataPackage);
       
   125     TInt DispatchGetLifeTimeL();
       
   126     TInt DispatchTerminateCallL(const CMmDataPackage* aDataPackage);
       
   127     TInt DispatchGetCallForwardingIndicatorL();
       
   128 	TInt DispatchUpdateLifeTimeL(const CMmDataPackage* aDataPackage);
       
   129 
       
   130 	// Complete functions for receiving completions UP from the Licensee LTSY
       
   131 	// via the CCtsyDispatcherCallback object.
       
   132 
       
   133 	void CallbackNotifyCallStatusChange(TInt aError, TInt aCallId, RMobileCall::TMobileCallStatus aMobileCallStatus);
       
   134 	void CallbackReceiveUui(TInt aError, TInt aCallId, const TDesC& aCallUui);
       
   135 	void CallbackNotifyDataCallCapsChange(TInt aError, TInt aCallId, const RMobileCall::TMobileCallDataCapsV1& aMobileCallDataCaps);
       
   136 	void CallbackNotifyIncomingCall(TInt aError, const RMobileCall::TMobileCallInfoV1& aCallInfo);
       
   137 	void CallbackNotifyHscsdInfoChange(TInt aError, TInt aCallId, const RMobileCall::TMobileCallHscsdInfoV8& aCallParams, const RMobileCall::TMobileCallDataCapsV1& aCallCaps);
       
   138 	void CallbackNotifyCallEvent(TInt aError, TInt aCallId, RMobileCall::TMobileCallEvent aCallEvent);
       
   139 	void CallbackNotifyCallInfoChange(TInt aError, const RMobileCall::TMobileCallInfoV1& aMobileCallInfo);
       
   140     void CallbackRemoteAlertingToneChange(TInt aError, RMmCustomAPI::TRemoteAlertingToneStatus aRemoteAlertingTone);
       
   141 	void CallbackAnswer(TInt aError, TInt aCallId);
       
   142 	void CallbackHold(TInt aError, TInt aCallId);
       
   143 	void CallbackDialEmergency(TInt aError, TInt aCallId);
       
   144 	void CallbackStopDtmfTone(TInt aError);
       
   145 	void CallbackSetActiveAlsLine(TInt aError);
       
   146 	void CallbackSendDtmfTonesCancel(TInt aError);
       
   147 	void CallbackHangUp(TInt aError, TInt aCallId);
       
   148 	void CallbackResume(TInt aError, TInt aCallId);
       
   149 	void CallbackSetDynamicHscsdParams(TInt aError, TInt aCallId);
       
   150 	void CallbackDialVoice(TInt aError, TInt aCallId);
       
   151 	void CallbackTransfer(TInt aError);
       
   152 	void CallbackSendDtmfTones(TInt aError);
       
   153 	void CallbackGetIdentityServiceStatus(TInt aError, RMobilePhone::TMobilePhoneIdServiceStatus aIdentityServiceStatus);
       
   154 	void CallbackSwap(TInt aError);
       
   155 	void CallbackStartDtmfTone(TInt aError);
       
   156 	void CallbackGetActiveAlsLine(TInt aError, RMobilePhone::TMobilePhoneALSLine aAlsLine);
       
   157 	void CallbackDialData(TInt aError, TInt aCallId);
       
   158 	void CallbackQueryIsEmergencyNumber(CRequestQueueOneShot::TIpcDataPackage* aDataPackage);
       
   159 	void CallbackNotifyIccCallForwardingStatusChange(TInt aError, const RMobilePhone::TMobileAddress& aCallForwardingNo,
       
   160 			 								RMobilePhone::TCFUIndicatorStatusFlags aCallForwardingStatusFlags,
       
   161 			 								RMmCustomAPI::TMultipleSubscriberProfileID aMultipleSubscriberProfileId);
       
   162 	void CallbackGetAlsPpSupport(TInt aError, RMmCustomAPI::TAlsSupport aAlsStatus);
       
   163 	void CallbackGetAlsBlockedStatus(TInt aError, RMmCustomAPI::TGetAlsBlockStatus aAlsSupport);
       
   164 	void CallbackSetAlsBlocked(TInt aError);
       
   165 	void CallbackGetLifeTime(TInt aError);
       
   166 	void CallbackGetLifeTime(TInt aError, TUint32 aHours, TUint8 aMinutes);
       
   167 	void CallbackGetLifeTime(TInt aError, const TDateTime &aManufacturingDate);
       
   168 	void CallbackGetLifeTime(TInt aError, const TDateTime &aManufacturingDate, TUint32 aHours, TUint8 aMinutes);
       
   169 	void CallbackTerminateErrorCall(TInt aError);
       
   170 	void CallbackTerminateAllCalls(TInt aError);
       
   171 	void CallbackGetCallForwardingIndicator(TInt aError, RMobilePhone::TMobileTON aTypeOfNumber,
       
   172                                             RMobilePhone::TMobileNPI aMobilePlan,
       
   173                                             const TDesC &aNumber,
       
   174                                             RMobilePhone::TCFUIndicatorStatusFlags aCFUIndicatorStatusFlags,
       
   175                                             RMobilePhone::TMultipleSubscriberProfileID aMultipleSubscriberProfileId);
       
   176 	void CallbackUpdateLifeTimer(TInt aError);
       
   177 
       
   178 	// From MDispatcherCallback
       
   179 	void CallbackSync(CRequestQueueOneShot::TIpcDataPackage& aIpcDataPackage);
       
   180 
       
   181 	// Other public functions
       
   182 	void SetDispatcherHolder(TDispatcherHolder& aDispatcherHolder);
       
   183 
       
   184 private:
       
   185 
       
   186 	CCallControlDispatcher(MLtsyDispatchFactoryV1& aLtsyFactory,
       
   187 	   			  	 MmMessageManagerCallback& aMessageManagerCallback,
       
   188 	   			  	 CRequestQueueOneShot& aRequestAsyncOneShot);
       
   189 
       
   190 	void ConstructL();
       
   191 
       
   192 	// Helper functions
       
   193 	TInt DoDispatchDialL(const CMmDataPackage* aDataPackage, TBool aIsIsvCall, TBool aPerformFdnCheck);
       
   194 	TInt DoDispatchAnswerL(const CMmDataPackage* aDataPackage,	TBool aIsIsvRequest);
       
   195 	void DoCallbackDial(TInt aError, TInt aCallId, RMobilePhone::TMobileService aMode);
       
   196 	TInt DoSendDtmfTonesL(TInt aCallId, const TDesC& aTones);
       
   197 
       
   198 private:	// Not owned
       
   199 
       
   200 	MLtsyDispatchFactoryV1& iLtsyFactoryV1;
       
   201 	MmMessageManagerCallback& iMessageManagerCallback;
       
   202 	CRequestQueueOneShot& iRequestAsyncOneShot;
       
   203 	TDispatcherHolder* iDispatcherHolder;
       
   204 
       
   205 	// Interfaces in the Licensee LTSY, not owned by this object
       
   206 
       
   207     MLtsyDispatchCallControlAnswer* iLtsyDispatchCallControlAnswer;
       
   208     MLtsyDispatchCallControlHold* iLtsyDispatchCallControlHold;
       
   209     MLtsyDispatchCallControlDialEmergency* iLtsyDispatchCallControlDialEmergency;
       
   210     MLtsyDispatchCallControlStopDtmfTone* iLtsyDispatchCallControlStopDtmfTone;
       
   211     MLtsyDispatchCallControlSetActiveAlsLine* iLtsyDispatchCallControlSetActiveAlsLine;
       
   212     MLtsyDispatchCallControlSendDtmfTonesCancel* iLtsyDispatchCallControlSendDtmfTonesCancel;
       
   213     MLtsyDispatchCallControlHangUp* iLtsyDispatchCallControlHangUp;
       
   214     MLtsyDispatchCallControlResume* iLtsyDispatchCallControlResume;
       
   215     MLtsyDispatchCallControlSetDynamicHscsdParams* iLtsyDispatchCallControlSetDynamicHscsdParams;
       
   216     MLtsyDispatchCallControlDialVoice* iLtsyDispatchCallControlDialVoice;
       
   217     MLtsyDispatchCallControlTransfer* iLtsyDispatchCallControlTransfer;
       
   218     MLtsyDispatchCallControlSendDtmfTones* iLtsyDispatchCallControlSendDtmfTones;
       
   219     MLtsyDispatchCallControlGetIdentityServiceStatus* iLtsyDispatchCallControlGetIdentityServiceStatus;
       
   220     MLtsyDispatchCallControlSwap* iLtsyDispatchCallControlSwap;
       
   221     MLtsyDispatchCallControlLoanDataPort* iLtsyDispatchCallControlLoanDataPort;
       
   222     MLtsyDispatchCallControlRecoverDataPort* iLtsyDispatchCallControlRecoverDataPort;
       
   223     MLtsyDispatchCallControlStartDtmfTone* iLtsyDispatchCallControlStartDtmfTone;
       
   224     MLtsyDispatchCallControlGetActiveAlsLine* iLtsyDispatchCallControlGetActiveAlsLine;
       
   225     MLtsyDispatchCallControlDialData* iLtsyDispatchCallControlDialData;
       
   226     MLtsyDispatchCallControlQueryIsEmergencyNumber* iLtsyDispatchCallControlQueryIsEmergencyNumber;
       
   227     MLtsyDispatchCallControlGetAlsPpSupport* iLtsyDispatchCallControlGetAlsPpSupport;
       
   228     MLtsyDispatchCallControlGetAlsBlockedStatus* iLtsyDispatchCallControlGetAlsBlockedStatus;
       
   229     MLtsyDispatchCallControlSetAlsBlocked* iLtsyDispatchCallControlSetAlsBlocked;
       
   230     MLtsyDispatchCallControlGetLifeTime* iLtsyDispatchCallControlGetLifeTime;
       
   231     MLtsyDispatchCallControlTerminateErrorCall* iLtsyDispatchCallControlTerminateErrorCall;
       
   232     MLtsyDispatchCallControlTerminateAllCalls* iLtsyDispatchCallControlTerminateAllCalls;
       
   233     MLtsyDispatchCallControlGetCallForwardingIndicator* iLtsyDispatchCallControlGetCallForwardingIndicator;
       
   234 	MLtsyDispatchCallControlUpdateLifeTimer* iLtsyDispatchCallControlUpdateLifeTimer;
       
   235 
       
   236     // Other data items
       
   237 
       
   238     /**
       
   239      * Cache of phone number passed to dispatcher in a
       
   240      * ECustomCheckEmergencyNumberIPC request.
       
   241      */
       
   242     RMmCustomAPI::TMobileTelNumber iQueryEmergencyNumber;
       
   243 
       
   244     /**
       
   245      * Buffer containing remains of DTMF string to be sent.
       
   246      * This is used for handling 'w' (wait) characters passed into
       
   247      * RMobilePhone::SendDTMFTones
       
   248      */
       
   249     TBuf<KMaxInfoName> iDtmfString; // Created by this object but ownership passes to CTSY
       
   250 
       
   251     /**
       
   252      * The call ID of the call iDtmfString was sending tones to.
       
   253      * Used if client decides to continue sending the string.
       
   254      */
       
   255     TInt iCallIdForDtmf;
       
   256 
       
   257     /**
       
   258      * ETrue if a stop character has been found in the DTMF string,
       
   259      * therefore client needs to be notified of stop on completion of
       
   260      * send.
       
   261      */
       
   262     TBool iFoundDtmfStop;
       
   263 
       
   264     /**
       
   265      * Caches the mode used to dial a voice call.  This is needed for when the
       
   266      * auxiliary line is used to dial a call.  On the callback from the dial,
       
   267      * the CTSY needs the call mode to locate the call object to set the Call ID.
       
   268 	 */
       
   269     RMobilePhone::TMobileService iModeUsedForVoiceCallDial;
       
   270     
       
   271     /**
       
   272      * Caches whether an FDN check was performed, to allow the correct IPC to be 
       
   273      * completed.
       
   274      */
       
   275     TBool iFdnCheckPerformed;
       
   276 
       
   277     /**
       
   278      * These are the two Call IDs of the calls on which a swap operation
       
   279      * has been requested.  It allows the dispatcher to return a Call ID to the CTSY
       
   280      * on completion of a swap (if the swap failed) so that the CTSY can locate the
       
   281      * call object to complete the swap back to the client.
       
   282      *
       
   283      * These Call IDs should only have a value != -1 when there is a pending swap
       
   284      * operation.
       
   285      */
       
   286     TInt iSwapHeldCallId;
       
   287     TInt iSwapConnectedCallId;
       
   288 
       
   289     /**
       
   290      * These are the two Call IDs of the calls on which a transfer operation
       
   291      * has been requested. It is needed for the same reason as iSwapHeldCallId
       
   292      * and iSwapConnectedCallId above.
       
   293      */
       
   294     TInt iTransferHeldCallId;
       
   295     TInt iTransferSecondCallId;
       
   296 	}; // class CCallControlDispatcher
       
   297 
       
   298 #endif // __CCALLCONTROLDISPATCHER_H_
       
   299