telephonyserver/etelmultimode/CETEL/mm_conference.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 #include <etelext.h>
       
    17 #include <et_clsvr.h>
       
    18 #include <etelmm.h>
       
    19 #include "mm_hold.h"
       
    20 
       
    21 /************************************************************************/
       
    22 //
       
    23 //  RMobileConferenceCall
       
    24 //
       
    25 /************************************************************************/
       
    26 
       
    27 
       
    28 EXPORT_C RMobileConferenceCall::RMobileConferenceCall()
       
    29 	: iMmPtrHolder(NULL)
       
    30 /** Default constructor. */
       
    31 	{
       
    32 	}
       
    33 
       
    34 EXPORT_C void RMobileConferenceCall::ConstructL()
       
    35 /** Constructs and initializes the RMobileConferenceCall object. 
       
    36 @capability None
       
    37 */
       
    38 	{
       
    39 	__ASSERT_ALWAYS(iMmPtrHolder==NULL,PanicClient(EEtelPanicHandleNotClosed));
       
    40 	iMmPtrHolder = CMobileConferenceCallPtrHolder::NewL(CMobileConferenceCallPtrHolder::EMaxNumberConferenceCallPtrSlots,
       
    41 		CMobileConferenceCallPtrHolder::EMaxNumberConferenceCallPtrCSlots);
       
    42 	}
       
    43 
       
    44 EXPORT_C void RMobileConferenceCall::Destruct()
       
    45 /** C++ destructor. 
       
    46 @capability None
       
    47 */
       
    48 	{
       
    49 	delete iMmPtrHolder;
       
    50 	iMmPtrHolder = NULL;
       
    51 	ResetSessionHandle();
       
    52 	}
       
    53 
       
    54 EXPORT_C TInt RMobileConferenceCall::Open(RMobilePhone& aPhone)
       
    55 /** Opens a RMobileConferenceCall conference call sub-session from RMobilePhone.
       
    56 
       
    57 	The name of the sub-session opened in the TSY will equal the string defined
       
    58 	by the KETelConferenceCall LIT definition.
       
    59 	
       
    60 	This API currently supports only one conference call object in the TSY - so
       
    61 	this means only one conference call can be ongoing at any one time. The conference
       
    62 	call sub-session is opened from the phone (rather than from a line) in order
       
    63 	not to place any restrictions on the types of call that could be added to
       
    64 	the conference. It is up to the TSY to inform clients which calls can be added
       
    65 	to a conference by setting each call's dynamic KCapsJoin capability.
       
    66 	
       
    67 	@param aPhone The phone sub-session used to open the conference call.
       
    68 	@return KErrNone if successful, a system wide error code if not.
       
    69 
       
    70 @capability None
       
    71 */
       
    72 	{
       
    73 	RSessionBase* session=&aPhone.SessionHandle();
       
    74 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
    75 	TInt subSessionHandle=aPhone.SubSessionHandle();
       
    76 	__ASSERT_ALWAYS(subSessionHandle!=NULL,PanicClient(EEtelPanicNullHandle));
       
    77 
       
    78 	TRAPD(ret,ConstructL());
       
    79 	if (ret)
       
    80 		return ret;
       
    81 	TPtrC name(KETelConferenceCall);
       
    82 
       
    83 	SetSessionHandle(*session);
       
    84 	TIpcArgs args(&name,TIpcArgs::ENothing,subSessionHandle);
       
    85 
       
    86 	ret = CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
    87 	if (ret)
       
    88 		Destruct();
       
    89 	return ret;
       
    90 	}
       
    91 
       
    92 EXPORT_C void RMobileConferenceCall::Close()
       
    93 /** Closes a RMobileConferenceCall sub-session. 
       
    94 @capability None
       
    95 */
       
    96  	{
       
    97 	CloseSubSession(EEtelClose);
       
    98 	Destruct();
       
    99 	}
       
   100 
       
   101 EXPORT_C TInt RMobileConferenceCall::GetCaps(TUint32& aCaps) const
       
   102 /** 
       
   103 	Gets the current capabilities of the conference call.
       
   104 
       
   105 	@param aCaps On completion, a descriptor that will contain the conference
       
   106 	call capabilities; this consists of the sum of the TMobileConferenceCallCaps
       
   107 	constants.
       
   108 	@return KErrNone
       
   109 
       
   110 @capability None
       
   111 */
       
   112 	{
       
   113 	TPckg<TUint32> ptr1(aCaps);
       
   114 	return Get(EMobileConferenceCallGetCaps,ptr1);
       
   115 	}
       
   116 
       
   117 EXPORT_C void RMobileConferenceCall::NotifyCapsChange(TRequestStatus& aReqStatus, TUint32& aCaps) const
       
   118 /**
       
   119 	Allows clients to be notified when the conference call capabilities change.
       
   120 	
       
   121 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallNotifyCapsChange) 
       
   122 	to cancel a previously placed asynchronous NotifyCapsChange() request.
       
   123 	
       
   124 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   125 	if not.
       
   126 	@param aCaps On completion, a descriptor that will contain the new conference 
       
   127 	call capabilities, this consists of the sum of the TMobileConferenceCallCaps 
       
   128 	constants.
       
   129 
       
   130 @capability None
       
   131 */
       
   132 	{
       
   133 	__ASSERT_ALWAYS(iMmPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   134 
       
   135 	TPtr8& ptr1 = iMmPtrHolder->Set(CMobileConferenceCallPtrHolder::ESlot1NotifyConferenceCallCapsChange,aCaps);
       
   136 
       
   137 	Get(EMobileConferenceCallNotifyCapsChange,aReqStatus,ptr1);
       
   138 	}
       
   139 
       
   140 EXPORT_C void RMobileConferenceCall::CreateConference(TRequestStatus& aReqStatus) const
       
   141 /**
       
   142 	Allows clients to create the initial 3-way conference call.
       
   143 	
       
   144 	The phone must be in a state where there are two single voice calls, one on 
       
   145 	hold and the other connected or alerting the remote, called party.
       
   146 	
       
   147 	The TSY will reflect the conference creation capability by setting the KCapsJoin 
       
   148 	flags of the individual calls and the KCapsCreate flag of the conference call 
       
   149 	sub-session. 
       
   150 	
       
   151 	In GSM mode, this function member will complete when the TSY has received 
       
   152 	confirmation from the network that the conference call service has been successfully 
       
   153 	invoked.
       
   154 	
       
   155 	In CDMA mode, this function member will complete when the TSY has sent the 
       
   156 	conference create request to the network. There is no response from CDMA networks 
       
   157 	to ascertain whether the request failed or succeeded.
       
   158 	
       
   159 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallCreateConference) 
       
   160 	to cancel a previously placed asynchronous CreateConference() request. 
       
   161 	
       
   162 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   163 	if not.
       
   164 
       
   165 @capability NetworkServices
       
   166 */
       
   167 	{
       
   168 	Blank(EMobileConferenceCallCreateConference,aReqStatus);
       
   169 	}
       
   170 
       
   171 EXPORT_C void RMobileConferenceCall::AddCall(TRequestStatus& aReqStatus, const TName& aCallName) const
       
   172 /**
       
   173 	Adds the single voice call to an existing conference call. 
       
   174 	
       
   175 	Only calls whose call control capabilities include KCapsJoin can be added 
       
   176 	to a conference call. 
       
   177 	
       
   178 	In GSM mode, this function member will complete when the TSY has received 
       
   179 	confirmation from the network that the conference call service has been successfully 
       
   180 	invoked and the call added.
       
   181 	
       
   182 	In CDMA mode, only 3-way conference calls are currently possible, so after 
       
   183 	the initial conference creation it is not possible to add further calls. Therefore 
       
   184 	single calls outside of the conference will never have the KCapsJoin capability 
       
   185 	set during CDMA mode. 
       
   186 	
       
   187 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallAddCall) to 
       
   188 	cancel a previously placed asynchronous AddCall() request.
       
   189 	
       
   190 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   191 	if not.
       
   192 	@param aCallName The call sub-session to add to the conference call.
       
   193 
       
   194 @capability NetworkServices
       
   195 */
       
   196 	{
       
   197 	Set(EMobileConferenceCallAddCall,aReqStatus,aCallName);
       
   198 	}
       
   199 
       
   200 EXPORT_C void RMobileConferenceCall::Swap(TRequestStatus& aReqStatus) const
       
   201 /**
       
   202 	Allows a client to switch a conference call between "Active" and "Hold" states. 
       
   203 	
       
   204 	This function member will complete either when the conference call has successfully 
       
   205 	moved to the opposite state or if the action failed due to some reason. Can 
       
   206 	be called by any client that has a handle on the conference call (i.e. not 
       
   207 	necessarily the client that first created the conference).
       
   208 	
       
   209 	This action is possible under two circumstances:
       
   210 	
       
   211 	There is just a conference call. This implies that there are no single calls 
       
   212 	already in the state to which the client wishes to toggle the conference call. 
       
   213 	The client will call Swap on the conference call and if it is active it will 
       
   214 	move to the held state and if it is held it will move to the active state.
       
   215 	
       
   216 	There is a conference call and a single call, one currently active and one 
       
   217 	on hold. This function member therefore swaps the conference call with the 
       
   218 	single call, simultaneously placing the active one on hold and resuming the 
       
   219 	held one.
       
   220 	
       
   221 	In either circumstance, the conference call capabilities will include the 
       
   222 	KCapsSwap flag. In GSM mode, this function member will complete when the TSY 
       
   223 	has received confirmation from the network that the conference call has been 
       
   224 	successfully moved to its opposite state. In CDMA mode, this function member 
       
   225 	will complete when the TSY has sent the swap request to the network. There 
       
   226 	is no response from CDMA networks to ascertain whether the request failed 
       
   227 	or succeeded.
       
   228 	
       
   229 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallSwap) to cancel 
       
   230 	a previously placed asynchronous Swap() request.
       
   231 	
       
   232 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   233 	if not.
       
   234 
       
   235 @capability NetworkServices
       
   236 */
       
   237 	{
       
   238 	Blank(EMobileConferenceCallSwap,aReqStatus);
       
   239 	}
       
   240 
       
   241 EXPORT_C void RMobileConferenceCall::HangUp(TRequestStatus& aReqStatus) const
       
   242 /**
       
   243 	Terminates the whole conference.
       
   244 	
       
   245 	All calls that are currently part of the conference will also be terminated. 
       
   246 	Can be called by any client that has a handle on the conference call (i.e. 
       
   247 	not necessarily the client that first created the conference). 
       
   248 	
       
   249 	This action is possible if the conference call capabilities include the KCapsHangUp 
       
   250 	flag. In GSM mode, this function member will complete when the TSY has received 
       
   251 	confirmation from the network that the conference call has been fully released. 
       
   252 	
       
   253 	
       
   254 	In CDMA mode, this function member will complete when the TSY has sent the 
       
   255 	hang-up request to the network. There is no response from CDMA networks to 
       
   256 	ascertain whether the request failed or succeeded.
       
   257 	
       
   258 	After termination, the conference call will consist of zero calls and will 
       
   259 	return to the EConferenceIdle state.
       
   260 	
       
   261 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallHangUp) to 
       
   262 	cancel a previously placed asynchronous HangUp() request.
       
   263 	
       
   264 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   265 	if not.
       
   266 
       
   267 @capability NetworkServices
       
   268 */
       
   269 	{
       
   270 	Blank(EMobileConferenceCallHangUp,aReqStatus);
       
   271 	}
       
   272 
       
   273 EXPORT_C TInt RMobileConferenceCall::EnumerateCalls(TInt& aCount) const
       
   274 /**
       
   275 	Gets the number of calls (i.e. call objects) that are 
       
   276 	currently part of the conference call.
       
   277 	
       
   278 	This number may be zero if a conference call is not active or equal to two 
       
   279 	or more if a conference call exists. 
       
   280 	
       
   281 	@param aCount On return, the number of calls - will be equal to 0 or >=2.
       
   282 	@return KErrNone
       
   283 
       
   284 @capability None
       
   285 */
       
   286 	{
       
   287 	TPckg<TInt> ptr1(aCount);
       
   288 	return Get(EMobileConferenceCallEnumerateCalls,ptr1);
       
   289 	}
       
   290 
       
   291 EXPORT_C TInt RMobileConferenceCall::GetMobileCallInfo(TInt aIndex, TDes8& aCallInfo) const
       
   292 /**
       
   293 	Gets a current snapshot of the call information associated 
       
   294 	with the call specified by the aIndex parameter.
       
   295 	
       
   296 	@param aIndex The index of the call = 0 to aCount-1 where aCount is the returned 
       
   297 	value from EnumerateCalls()
       
   298 	@param aCallInfo On completion, a RMobileCall::TMobileCallInfoV1Pckg containing 
       
   299 	the large block of call information.
       
   300 	@return KErrNone, if successful, KErrNotFound if call information is not available.
       
   301 
       
   302 @capability ReadDeviceData
       
   303 */
       
   304 	{
       
   305 	TPckg<TUint> ptr1(aIndex);
       
   306 	return Get(EMobileConferenceCallGetMobileCallInfo,ptr1,aCallInfo);	
       
   307 	}
       
   308 
       
   309 EXPORT_C TInt RMobileConferenceCall::GetConferenceStatus(TMobileConferenceStatus& aStatus) const
       
   310 /** 
       
   311 	Allows clients to retrieve the current status of the conference call.
       
   312 		
       
   313 	@param aStatus On completion, the new conference status.
       
   314 	@return KErrNone if successful, a system wide error code if not.
       
   315 
       
   316 @capability None
       
   317 */
       
   318 	{
       
   319 	TPckg<TMobileConferenceStatus> ptr1(aStatus);
       
   320 	return Get(EMobileConferenceCallGetConferenceStatus,ptr1);
       
   321 	}
       
   322 
       
   323 EXPORT_C void RMobileConferenceCall::NotifyConferenceStatusChange(TRequestStatus& aReqStatus, TMobileConferenceStatus& aStatus) const
       
   324 /**
       
   325 	Allows clients to be notified of a change in the status 
       
   326 	of a conference call.
       
   327 	
       
   328 	The notification completes when the TSY recognizes that a conference call 
       
   329 	has changed state.
       
   330 	
       
   331 	Conference calls may change state either as a result of a direct client action 
       
   332 	on the conference call sub-session (e.g. client puts the conference on hold 
       
   333 	or terminates the whole conference) or as a result of a client action on an 
       
   334 	individual call (e.g. a private communication with one call in a conference 
       
   335 	will put the rest of the conference on hold).
       
   336 	
       
   337 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallNotifyConferenceStatusChange) 
       
   338 	to cancel a previously placed asynchronous NotifyCapsChange() request.
       
   339 	
       
   340 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   341 	if not.
       
   342 	@param aStatus On return, the conference status.
       
   343 
       
   344 @capability None
       
   345 */
       
   346 	{
       
   347 	__ASSERT_ALWAYS(iMmPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));	
       
   348 
       
   349 	TPtr8& ptr1 = iMmPtrHolder->Set(CMobileConferenceCallPtrHolder::ESlot1NotifyConferenceStatusChange,aStatus);
       
   350 
       
   351 	Get(EMobileConferenceCallNotifyConferenceStatusChange,aReqStatus,ptr1);
       
   352 	}
       
   353 
       
   354 EXPORT_C void RMobileConferenceCall::NotifyConferenceEvent(TRequestStatus& aReqStatus, TMobileConferenceEvent& aEvent, TName& aCallName) const
       
   355 /**
       
   356 	This notification will complete when a conference call event occurs.
       
   357 	
       
   358 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileConferenceCallNotifyConferenceEvent) 
       
   359 	to cancel a previously placed asynchronous NotifyConferenceEvent() request.
       
   360 	
       
   361 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   362 	if not.
       
   363 	@param aEvent On completion, contains the conference event.
       
   364 	@param aCallName On completion, contains the name of the individual call, if 
       
   365 	the	event is a call added or dropped from a conference.
       
   366 
       
   367 @capability None
       
   368 */
       
   369 	{
       
   370 	__ASSERT_ALWAYS(iMmPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));	
       
   371 
       
   372 	TPtr8& ptr1 = iMmPtrHolder->Set(CMobileConferenceCallPtrHolder::ESlot1NotifyConferenceEvent,aEvent);
       
   373 
       
   374 	Get(EMobileConferenceCallNotifyConferenceEvent,aReqStatus,ptr1,aCallName);	
       
   375 	}
       
   376