telephonyserver/etelmultimode/CETEL/mm_messaging.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2000-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 // This file contains the method definitions for all EtelMM subsessions that
       
    15 // provide messaging functionality.
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file
       
    21 */
       
    22 
       
    23 // From core API
       
    24 #include <et_clsvr.h>
       
    25 #include <etelext.h>
       
    26 
       
    27 // Multimode header files
       
    28 #include <etelmm.h>
       
    29 #include <mmlist.h>
       
    30 #include <mmretrieve.h>
       
    31 
       
    32 #include "mm_hold.h"
       
    33 
       
    34 
       
    35 /************************************************************************/
       
    36 //
       
    37 //  RMobileSmsMessaging
       
    38 //
       
    39 /************************************************************************/
       
    40 
       
    41 EXPORT_C RMobileSmsMessaging::RMobileSmsMessaging() :
       
    42 	iSmsMessagingPtrHolder(NULL)
       
    43 /** 
       
    44 	Standard constructor.
       
    45 	This member is internal and not intended for public use.
       
    46 */
       
    47 	{
       
    48 	}
       
    49 
       
    50 EXPORT_C TInt RMobileSmsMessaging::Open(RMobilePhone& aPhone)
       
    51 
       
    52 /**
       
    53 	This member function opens a SMS Messaging object. The name of the sub-session 
       
    54 	opened in the TSY will equal the string defined by the KETelSmsMessaging LIT 
       
    55 	definition. 
       
    56 	
       
    57 	@param aPhone An existing RMobilePhone session.
       
    58 	@return KErrNone if successful.
       
    59  
       
    60 @capability None
       
    61 */
       
    62 	{
       
    63 	RSessionBase* session=&aPhone.SessionHandle();
       
    64 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
    65 	TInt subSessionHandle=aPhone.SubSessionHandle();
       
    66 	__ASSERT_ALWAYS(subSessionHandle!=NULL,PanicClient(EEtelPanicNullHandle));
       
    67 
       
    68 	TRAPD(ret,ConstructL()); 
       
    69 	if (ret)
       
    70 		return ret;
       
    71 	TPtrC name(KETelSmsMessaging);	
       
    72 	SetSessionHandle(*session);
       
    73 	TIpcArgs args(&name,TIpcArgs::ENothing,subSessionHandle);
       
    74 	ret = CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
    75 	if (ret)
       
    76 		Destruct();
       
    77 	return ret;
       
    78 	}
       
    79 
       
    80 EXPORT_C void RMobileSmsMessaging::Close()
       
    81 /**
       
    82 	This method closes a RMobileSmsMessaging subsession
       
    83  
       
    84 @capability None
       
    85 */
       
    86  	{
       
    87 	CloseSubSession(EEtelClose);
       
    88 	Destruct();
       
    89 	}
       
    90 
       
    91 EXPORT_C void RMobileSmsMessaging::ConstructL()
       
    92 /**	Constructor. */
       
    93 	{
       
    94 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder==NULL,PanicClient(EEtelPanicHandleNotClosed));
       
    95 	iSmsMessagingPtrHolder = CSmsMessagingPtrHolder::NewL(CSmsMessagingPtrHolder::EMaxNumberSmsPtrSlots,CSmsMessagingPtrHolder::EMaxNumberSmsPtrCSlots);
       
    96 	}
       
    97 
       
    98 EXPORT_C void RMobileSmsMessaging::Destruct()
       
    99 /** Destructor. */
       
   100 	{
       
   101 	delete iSmsMessagingPtrHolder;
       
   102 	iSmsMessagingPtrHolder = NULL;
       
   103 	ResetSessionHandle();
       
   104 	}
       
   105 
       
   106 RMobileSmsMessaging::TMobileSmsAttributesV1::TMobileSmsAttributesV1() 
       
   107 :	iFlags(0), 
       
   108 	iDataFormat(EFormatUnspecified),
       
   109 	iCdmaTeleservice(0),
       
   110 	iCdmaServiceCategory(0)
       
   111 /** Constructor. */
       
   112 	{
       
   113 	}
       
   114 
       
   115 EXPORT_C RMobileSmsMessaging::TMobileSmsReceiveAttributesV1::TMobileSmsReceiveAttributesV1() 
       
   116 :	iStatus(EMtMessageUnknownStatus),
       
   117 	iStoreIndex(0)
       
   118 /** Constructor. */
       
   119 	{
       
   120 	iExtensionId=KETelMobileSmsReceiveAttributesV1;
       
   121 	}
       
   122 
       
   123 EXPORT_C RMobileSmsMessaging::TMobileSmsSendAttributesV1::TMobileSmsSendAttributesV1() 
       
   124 :	iMsgRef(0),
       
   125 	iMore(EFalse)
       
   126 /** Constructor. */
       
   127 	{
       
   128 	iExtensionId=KETelMobileSmsSendAttributesV1;
       
   129 	}
       
   130 
       
   131 EXPORT_C RMobileSmsMessaging::TMobileSmsCdmaSendAttributesV4::TMobileSmsCdmaSendAttributesV4() 
       
   132 :	iMsgRef(0), 
       
   133 	iMore(EFalse),
       
   134 	iAddressAuthentication(0)
       
   135 /** Constructor. */
       
   136 	{
       
   137 	iExtensionId=KETelMobileSmsCdmaSendAttributesV4;
       
   138 	}
       
   139 
       
   140 EXPORT_C RMobileSmsMessaging::TMobileSmsCapsV1::TMobileSmsCapsV1() 
       
   141 :	iSmsMode(0), 
       
   142 	iSmsControl(0)
       
   143 /** Constructor. */
       
   144 	{
       
   145 	iExtensionId=KETelExtMultimodeV1;
       
   146 	}
       
   147 
       
   148 EXPORT_C TInt RMobileSmsMessaging::GetCaps(TDes8& aCaps) const
       
   149 /**
       
   150 	This member function gets a class that reflects the SMS messaging capabilities
       
   151 	of the phone.
       
   152 	
       
   153 	@param aCaps On return, a TMobileSmsCapsV1Pckg with the SMS messaging capabilities
       
   154 	of the phone.
       
   155 	@return KErrNone if successful.
       
   156 	@see TMobileSmsCapsV1
       
   157  
       
   158 @capability None
       
   159 */
       
   160 	{
       
   161 	return Get(EMobileSmsMessagingGetCaps, aCaps);
       
   162 	}
       
   163 
       
   164 EXPORT_C TInt RMobileSmsMessaging::GetReceiveMode(TMobileSmsReceiveMode& aReceiveMode) const
       
   165 /**
       
   166 	This member function retrieves the current setting of the TSY-phone incoming 
       
   167 	SMS receive mode. This setting dictates how the phone will handle incoming 
       
   168 	SMS messages before passing them on to TSY.
       
   169 	
       
   170 	@param aReceiveMode On return, the current receive mode.
       
   171 	@return KErrNone if successful.
       
   172  
       
   173 @capability None
       
   174 */
       
   175 	{
       
   176 	TPckg<TMobileSmsReceiveMode> ptr1(aReceiveMode);
       
   177 	return Get(EMobileSmsMessagingGetReceiveMode, ptr1);
       
   178 	}
       
   179 
       
   180 EXPORT_C void RMobileSmsMessaging::SetReceiveMode(TRequestStatus& aReqStatus, TMobileSmsReceiveMode aReceiveMode) const
       
   181 
       
   182 /**
       
   183 	This member function sets the setting of the TSY-phone incoming SMS receive 
       
   184 	mode. This setting dictates how the phone will handle incoming SMS messages 
       
   185 	before passing them on to TSY.
       
   186 	
       
   187 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingSetReceiveMode) 
       
   188 	to cancel a previously placed asynchronous SetReceiveMode() request.
       
   189 	
       
   190 	@param aReqStatus On return, KErrNone if successful.
       
   191 	@param aReceiveMode The receive mode to set.
       
   192  
       
   193 @capability WriteDeviceData
       
   194 */
       
   195 	{
       
   196 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   197 	iSmsMessagingPtrHolder->iReceiveMode = aReceiveMode;
       
   198 	TPtrC8& ptr1=iSmsMessagingPtrHolder->SetC(CSmsMessagingPtrHolder::ESlot1SetReceiveMode,iSmsMessagingPtrHolder->iReceiveMode);
       
   199 
       
   200 	Set(EMobileSmsMessagingSetReceiveMode, aReqStatus, ptr1);
       
   201 	}
       
   202 
       
   203 EXPORT_C void RMobileSmsMessaging::NotifyReceiveModeChange(TRequestStatus& aReqStatus, TMobileSmsReceiveMode& aReceiveMode)
       
   204 /**
       
   205 	This member function is used to notify the client if there is a change to the 
       
   206 	setting of the TSY-Phone receive mode.
       
   207 	
       
   208 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingNotifyReceiveModeChange) 
       
   209 	to cancel a previously placed asynchronous NotifyReceiveModeChange() request.
       
   210 	
       
   211 	@param aReqStatus On return, KErrNone if successful
       
   212 	@param aReceiveMode On return, the new SMS receive mode.
       
   213  
       
   214 @capability None
       
   215 */
       
   216 	{
       
   217 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   218 
       
   219 	TPtr8& ptr1=iSmsMessagingPtrHolder->Set(CSmsMessagingPtrHolder::ESlot1NotifyReceiveModeChange,aReceiveMode);
       
   220 
       
   221 	Get(EMobileSmsMessagingNotifyReceiveModeChange, aReqStatus, ptr1);
       
   222 	}
       
   223 
       
   224 EXPORT_C void RMobileSmsMessaging::ReceiveMessage(TRequestStatus& aReqStatus, TDes8& aMsgData, TDes8& aMsgAttributes) const
       
   225 /**
       
   226 	This member function will be used to wait for the next incoming SMS message. 
       
   227 	Once this member function completes, the client should immediately repost 
       
   228 	it if they want to receive the next incoming SMS message.
       
   229 	
       
   230 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingReceiveMessage) 
       
   231 	to cancel a previously placed asynchronous ReceiveMessage() request.
       
   232 	
       
   233 	@param aReqStatus On return, KErrNone if successful.
       
   234 	@param aMsgData On completion, the message data.
       
   235 	@param aMsgAttributes On completion, a TMobileSmsReceiveAttributesV1Pckg containing 
       
   236 	the message attributes.
       
   237 	@see TMobileSmsReceiveAttributesV1
       
   238  
       
   239 @capability NetworkServices
       
   240 @capability ReadUserData
       
   241 */
       
   242 	{
       
   243 	Get(EMobileSmsMessagingReceiveMessage, aReqStatus, aMsgData, aMsgAttributes);
       
   244 	}
       
   245 
       
   246 EXPORT_C void RMobileSmsMessaging::AckSmsStored(TRequestStatus& aReqStatus, const TDesC8& aMsgData, TBool aFull) const
       
   247 /**
       
   248 	When the client receives an unstored SMS, it will use this member function 
       
   249 	to return a positive acknowledgment if it manages to successfully decode and 
       
   250 	store that SMS. If the client wishes to send a SMS-DELIVER-REPORT in response 
       
   251 	to the received SMS-DELIVER , than the aMsgData parameter will be used to 
       
   252 	hold the TPDU defined for a SMS-DELIVER-REPORT (for RP-ACK) in GSM 03.40.
       
   253 	
       
   254 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingAckSmsStored) 
       
   255 	to cancel a previously placed asynchronous AckSmsStored() request.
       
   256 	
       
   257 	@param aReqStatus On return, KErrNone if successful.
       
   258 	@param aMsgData Holds the TPDU defined for a SMS-DELIVER-REPORT (for RP-ACK) 
       
   259 	in GSM 03.40.
       
   260 	@param aFull Indicates whether, after storing the acknowledged message, the 
       
   261 	client-side message store is now full or not. If client sets it to ETrue then 
       
   262 	it is informing the TSY that the store is full (or almost full) and that it 
       
   263 	does not want to receive any more messages until it calls ResumeSmsReception().
       
   264  
       
   265 @capability NetworkServices
       
   266 @capability NetworkControl
       
   267 */
       
   268 	{
       
   269 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   270 	
       
   271 	iSmsMessagingPtrHolder->iAckSmsStoredFull = aFull;
       
   272 	TPtrC8& ptr1=iSmsMessagingPtrHolder->SetC(CSmsMessagingPtrHolder::ESlot1AckSmsStored,iSmsMessagingPtrHolder->iAckSmsStoredFull);
       
   273 
       
   274 	Set(EMobileSmsMessagingAckSmsStored, aReqStatus, aMsgData ,ptr1);
       
   275 	}
       
   276 
       
   277 EXPORT_C void RMobileSmsMessaging::NackSmsStored(TRequestStatus& aReqStatus, const TDesC8& aMsg, TInt aRpCause) const
       
   278 /** When the client receives an unstored SMS, it will use this member function 
       
   279 	to return a negative acknowledgment if it fails to decode and/or store that 
       
   280 	SMS.
       
   281 	
       
   282 	This TPDU will contain the TP error cause that prevents the client from acknowledging 
       
   283 	the SMS. The client should also provide the RP error cause by placing it in 
       
   284 	the aRpCause parameter. 
       
   285 	
       
   286 	In GSM mode, once a client has rejected a received SMS due to storage full, 
       
   287 	the network will keep this message for later and suspend the forwarding of 
       
   288 	any further received SMS to this MS.
       
   289 	
       
   290 	In CDMA mode, the network will save the message but it will repeat sending 
       
   291 	of the message to the MS until either the MS eventually accepts it or the 
       
   292 	retry limit is reached.
       
   293 	
       
   294 	If retry limit is reached the network will tell the originator of the message 
       
   295 	that the transmission failed. In either case, when client-side memory is freed-up, 
       
   296 	the client must call ResumeSmsReception() in order to tell the phone and possibly 
       
   297 	the network that SMS can be received again.
       
   298 	
       
   299 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingNackSmsStored) 
       
   300 	to cancel a previously placed asynchronous NackSmsStored() request.
       
   301 	
       
   302 	@param aReqStatus On return, KErrNone if successful.
       
   303 	@param aMsg Holds the TPDU defined for a SMS-DELIVER-REPORT (for RP-ERROR) 
       
   304 	in GSM 03.40.
       
   305 	@param aRpCause Contain one of the MS related extended error codes.
       
   306  
       
   307 @capability NetworkServices
       
   308 @capability NetworkControl
       
   309 */
       
   310 	{
       
   311 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   312 	iSmsMessagingPtrHolder->iNackSmsStoredCause = aRpCause;
       
   313 	TPtrC8& ptr1=iSmsMessagingPtrHolder->SetC(CSmsMessagingPtrHolder::ESlot1NackSmsStored,iSmsMessagingPtrHolder->iNackSmsStoredCause);
       
   314 
       
   315 	Set(EMobileSmsMessagingNackSmsStored, aReqStatus, aMsg, ptr1);
       
   316 	}
       
   317 
       
   318 EXPORT_C void RMobileSmsMessaging::ResumeSmsReception(TRequestStatus& aReqStatus) const
       
   319 /**
       
   320 	This member functions resumes the reception of SMS messages.
       
   321 	
       
   322 	SMS reception can become suspended because SMS storage is full. Therefore 
       
   323 	if client-side storage is full, the client must stop receiving unstored messages. 
       
   324 	However, if the user deletes some client-side stored SMS messages, the client 
       
   325 	must use this member function to tell the TSY to inform a GSM network that 
       
   326 	messages can be received again or the phone that CDMA messages can be accepted 
       
   327 	again.
       
   328 	
       
   329 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingResumeSmsReception) 
       
   330 	to cancel a previously placed asynchronous ResumeSmsReception() request.
       
   331 	
       
   332 	@param aReqStatus On return, KErrNone if successful.
       
   333  
       
   334 @capability NetworkServices
       
   335 @capability NetworkControl
       
   336 */
       
   337 	{
       
   338 	Blank(EMobileSmsMessagingResumeSmsReception, aReqStatus);
       
   339 	}
       
   340 
       
   341 EXPORT_C void RMobileSmsMessaging::SendMessage(TRequestStatus& aReqStatus,  const TDesC8& aMsgData, TDes8& aMsgAttributes) const
       
   342 /**
       
   343 	This member function sends an SMS message to the network.
       
   344 	
       
   345 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingSendMessage) 
       
   346 	to cancel a previously placed asynchronous SendMessage() request.
       
   347 	
       
   348 	@param aReqStatus On return, KErrNone if successful, KErrNotSupported if the 
       
   349 	phone does not support outgoing SMS, KErrMMEtelFormatNotSupported if the phone 
       
   350 	does not support the client's chosen message data format, any of the KErrGsmSms… 
       
   351 	extended errors if the phone is in GSM mode and this is the error returned 
       
   352 	by the GSM network/service centre, Any of the KErrCdmaSms… extended errors 
       
   353 	if the phone is in CDMA mode and this is the error returned by the CDMA network/service 
       
   354 	centre. Please note that the last three examples are "extended" errors and 
       
   355 	will only be returned to those clients that request them. Clients that only 
       
   356 	understand core Symbian OS and ETel errors will receive KErrGeneral for any 
       
   357 	error cases that the TSY can not interpret.
       
   358 	@param aMsgData The message data
       
   359 	@param aMsgAttributes A TMobileSmsSendAttributesV1Pckg with the message attributes. 
       
   360 	The fields required will probably be message data format, destination and 
       
   361 	possibly a new service centre address. On return, for either successful or 
       
   362 	failed transmission, the message reference number assigned to this sent message 
       
   363 	will be placed by the TSY in the iMsgRef field. Also, if the SMS was sent 
       
   364 	during GSM or WCDMA mode, then the SMS-SUBMIT-REPORT will be placed by the 
       
   365 	TSY in the iSubmitReport field.
       
   366 	@see TMobileSmsSendAttributesV1
       
   367  
       
   368 @capability NetworkServices
       
   369 @capability WriteUserData
       
   370 */
       
   371 	{
       
   372 	SetAndGet(EMobileSmsMessagingSendMessage, aReqStatus,aMsgData,aMsgAttributes);
       
   373 	}
       
   374 
       
   375 EXPORT_C void RMobileSmsMessaging::SendMessageNoFdnCheck(TRequestStatus& aReqStatus,  const TDesC8& aMsgData, TDes8& aMsgAttributes) const
       
   376 /**
       
   377 	Sends an outgoing SMS to the network. 
       
   378 	
       
   379 	The number used for sending the SMS is not checked against those in the 
       
   380 	Fixed Dialling Number list even if the FDN service is enabled.
       
   381 	
       
   382 	@param aMsgData Supplies the TPDU to send
       
   383 	@param aMsgAttributes Supplies the attributes of the outgoing message
       
   384  
       
   385 @capability NetworkServices
       
   386 @capability NetworkControl
       
   387 */
       
   388 	{
       
   389 	SetAndGet(EMobileSmsMessagingSendMessageNoFdnCheck, aReqStatus,aMsgData,aMsgAttributes);
       
   390 	}
       
   391 
       
   392 EXPORT_C void RMobileSmsMessaging::SetMoSmsBearer(TRequestStatus& aReqStatus, TMobileSmsBearer aBearer) const
       
   393 /**
       
   394 	This member function sets the bearer type (GSM or GPRS) for sending SMS messages.
       
   395 	
       
   396 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingSetMoSmsBearer) 
       
   397 	to cancel a previously placed asynchronous SetMoSmsBearer() request.
       
   398 	
       
   399 	@param aReqStatus On return, KErrNone if successful.
       
   400 	@param aBearer The bearer type to set.
       
   401  
       
   402 @capability WriteDeviceData
       
   403 */
       
   404 	{
       
   405 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   406 	iSmsMessagingPtrHolder->iSmsBearer = aBearer;
       
   407 	TPtrC8& ptr1=iSmsMessagingPtrHolder->SetC(CSmsMessagingPtrHolder::ESlot1SetMoSmsBearer,iSmsMessagingPtrHolder->iSmsBearer);
       
   408 
       
   409 	Set(EMobileSmsMessagingSetMoSmsBearer, aReqStatus, ptr1);
       
   410 	}
       
   411 
       
   412 EXPORT_C TInt RMobileSmsMessaging::GetMoSmsBearer(TMobileSmsBearer& aBearer) const
       
   413 /**
       
   414 	This member function is used to retrieve the current setting for the bearer 
       
   415 	type (GSM or GPRS) used for sending SMS messages. 
       
   416 	
       
   417 	@param aBearer On return, the current bearer type.
       
   418 	@return KErrNone if successful.
       
   419  
       
   420 @capability None
       
   421 */
       
   422 	{
       
   423 	TPckg<TMobileSmsBearer> ptr1(aBearer);
       
   424 	return Get(EMobileSmsMessagingGetMoSmsBearer, ptr1);
       
   425 	}
       
   426 
       
   427 EXPORT_C void RMobileSmsMessaging::NotifyMoSmsBearerChange(TRequestStatus& aReqStatus, TMobileSmsBearer& aBearer)
       
   428 /**
       
   429 	This member function is used t notify the client if there is a change to the 
       
   430 	setting for the bearer type used for sending SMS messages. 
       
   431 	
       
   432 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingNotifyMoSmsBearerChange) 
       
   433 	to cancel a previously placed asynchronous NotifyMoSmsBearerChange() request.
       
   434 	
       
   435 	@param aReqStatus On return, KErrNone if successful.
       
   436 	@param aBearer On completion, the new bearer.
       
   437  
       
   438 @capability None
       
   439 */
       
   440 	{
       
   441 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   442 
       
   443 	TPtr8& ptr1=iSmsMessagingPtrHolder->Set(CSmsMessagingPtrHolder::ESlot1NotifyMoSmsBearerChange,aBearer);
       
   444 
       
   445 	Get(EMobileSmsMessagingNotifyMoSmsBearerChange, aReqStatus, ptr1);
       
   446 	}
       
   447 
       
   448 //
       
   449 // SMS related storage
       
   450 //
       
   451 
       
   452 EXPORT_C TInt RMobileSmsMessaging::EnumerateMessageStores(TInt& aCount) const
       
   453 
       
   454 /**
       
   455 	This request gets the number of phone-side SMS message stores supported by 
       
   456 	the phone in the aCount parameter.
       
   457 	
       
   458 	@param aCount On return, the number of phone-side SMS message stores.
       
   459 	@return KErrNone if successful.
       
   460  
       
   461 @capability None
       
   462 */
       
   463 	{
       
   464 	TPckg<TInt> ptr1(aCount);
       
   465 	return Get(EMobileSmsMessagingEnumerateMessageStores, ptr1);
       
   466 	}
       
   467 
       
   468 EXPORT_C void RMobileSmsMessaging::GetMessageStoreInfo(TRequestStatus& aReqStatus, TInt aIndex, TDes8& aInfo) const
       
   469 /**
       
   470 	This request gets information about the SMS message store.
       
   471 	
       
   472 	Use	RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingGetMessageStoreInfo) 
       
   473 	to cancel a previously placed asynchronous GetMessageStoreInfo() request.
       
   474 	
       
   475 	@param aReqStatus On return, KErrNone if successful
       
   476 	@param aIndex The index of the store, valid values are between 0 and (n-1), 
       
   477 	where n is given by the EnumerateMessageStores() request.
       
   478 	@param aInfo On comletion, a RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg 
       
   479 	holding the SMS message store info.
       
   480 	@see RMobilePhoneStore::TMobilePhoneStoreInfoV1
       
   481  
       
   482 @capability None
       
   483 */
       
   484 	{
       
   485 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   486 	
       
   487 	iSmsMessagingPtrHolder->iGetMessageStoreInfoIndex = aIndex;
       
   488 	TPtrC8& ptr1=iSmsMessagingPtrHolder->SetC(CSmsMessagingPtrHolder::ESlot1GetMessageStoreInfo,iSmsMessagingPtrHolder->iGetMessageStoreInfoIndex);
       
   489 
       
   490 	SetAndGet(EMobileSmsMessagingGetMessageStoreInfo, aReqStatus, ptr1, aInfo);
       
   491 	}
       
   492 
       
   493 //
       
   494 // SMS Parameter Storage
       
   495 //
       
   496 
       
   497 EXPORT_C RMobileSmsMessaging::TMobileSmspEntryV1::TMobileSmspEntryV1() 
       
   498 : 	iValidParams(0), 
       
   499 	iProtocolId(0), 
       
   500 	iDcs(0), 
       
   501 	iValidityPeriod(0),
       
   502 	iReservedFiller(0)
       
   503 	{
       
   504 	iExtensionId=KETelExtMultimodeV1;
       
   505 	}
       
   506 
       
   507 void RMobileSmsMessaging::TMobileSmspEntryV1::InternalizeL(RReadStream& aStream)
       
   508 /**
       
   509 	This method internalizes the SMS parameter entry from a stream 
       
   510 	
       
   511 	@param aStream The read stream containing the SMS parameter entry
       
   512  */
       
   513 	{
       
   514 	TMultimodeType::InternalizeL(aStream);
       
   515 	iIndex = aStream.ReadInt32L();
       
   516 	aStream >> iText;
       
   517 	iValidParams = aStream.ReadUint32L();
       
   518 	aStream >> iDestination;
       
   519 	aStream >> iServiceCentre;
       
   520 	iProtocolId = aStream.ReadUint8L();
       
   521 	iDcs = aStream.ReadUint8L();
       
   522 	iValidityPeriod = aStream.ReadUint8L();
       
   523 	}
       
   524 
       
   525 void RMobileSmsMessaging::TMobileSmspEntryV1::ExternalizeL(RWriteStream& aStream) const
       
   526 /**
       
   527 	This method externalizes the SMS parameter entry into a stream 
       
   528 	@param aStream The write stream that will contain the SMS parameter entry
       
   529  */
       
   530 	{
       
   531 	TMultimodeType::ExternalizeL(aStream);
       
   532 	aStream.WriteInt32L(iIndex);
       
   533 	aStream << iText;
       
   534 	aStream.WriteUint32L(iValidParams);
       
   535 	aStream << iDestination;
       
   536 	aStream << iServiceCentre;
       
   537 	aStream.WriteUint8L(iProtocolId);
       
   538 	aStream.WriteUint8L(iDcs);
       
   539 	aStream.WriteUint8L(iValidityPeriod);
       
   540 	}
       
   541 
       
   542 
       
   543 EXPORT_C void RMobileSmsMessaging::StoreSmspListL(TRequestStatus& aReqStatus, CMobilePhoneSmspList* aSmspList) const
       
   544 /**
       
   545 	This member function may be used to store a new version of the entire list 
       
   546 	of SMSP entries. It will overwrite the current contents of the storage and 
       
   547 	may cause other clients to be notified of the change in SMSP list.
       
   548 	
       
   549 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingStoreSmspList) 
       
   550 	to cancel a previously placed asynchronous StoreSmspListL() request.
       
   551 	
       
   552 	@leave k Will leave if the CBufFlat to hold the streamed contents can not be allocated
       
   553 	@param aReqStatus On return, KErrNone if successful.
       
   554 	@param aSmspList The list of SMSP entries to store, should not contain more 
       
   555 	entries than can be stored phone-side.
       
   556  
       
   557 @capability WriteDeviceData
       
   558 */
       
   559 	{
       
   560 	__ASSERT_ALWAYS(aSmspList!=NULL,PanicClient(EEtelPanicNullHandle));
       
   561 	__ASSERT_ALWAYS(iSmsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   562 
       
   563 	delete iSmsMessagingPtrHolder->iSmspBuf;
       
   564 	iSmsMessagingPtrHolder->iSmspBuf = NULL;
       
   565 
       
   566 	iSmsMessagingPtrHolder->iSmspBuf=aSmspList->StoreLC();
       
   567 	CleanupStack::Pop();
       
   568 
       
   569 	(iSmsMessagingPtrHolder->iSmspPtr).Set((iSmsMessagingPtrHolder->iSmspBuf)->Ptr(0));
       
   570 
       
   571 	Set(EMobileSmsMessagingStoreSmspList,aReqStatus,iSmsMessagingPtrHolder->iSmspPtr);
       
   572 
       
   573 	}
       
   574 
       
   575 EXPORT_C void RMobileSmsMessaging::NotifySmspListChange(TRequestStatus& aReqStatus) const
       
   576 /**
       
   577 	This member function allows a client to be notified that changes have been 
       
   578 	made to the SMSP list. When it completes, it does not return the new version 
       
   579 	of the list so the client will have to retrieve the list again if it is interested 
       
   580 	in the new list.
       
   581 	
       
   582 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileSmsMessagingNotifySmspListChange) 
       
   583 	to cancel a previously placed asynchronous NotifySmspListChange() request.
       
   584 	
       
   585 	@param aReqStatus On return, KErrNone if successful.
       
   586  
       
   587 @capability None
       
   588 */
       
   589 	{
       
   590 	Blank(EMobileSmsMessagingNotifySmspListChange,aReqStatus);
       
   591 	}
       
   592 
       
   593 
       
   594 /************************************************************************/
       
   595 //
       
   596 //  RMobileBroadcastMessaging
       
   597 //
       
   598 /************************************************************************/
       
   599 
       
   600 EXPORT_C RMobileBroadcastMessaging::RMobileBroadcastMessaging() :
       
   601 	iCbsMessagingPtrHolder(NULL)
       
   602 /** Standard constructor. */
       
   603 	{
       
   604 	}
       
   605 
       
   606 EXPORT_C TInt RMobileBroadcastMessaging::Open(RMobilePhone& aPhone)
       
   607 /**
       
   608 	This function member opens a Broadcast Messaging object. The name of the sub-session 
       
   609 	opened in the TSY will equal the string defined by the KETelBroadcastMessaging 
       
   610 	LIT definition. 
       
   611 	
       
   612 	@param aPhone The existing RMobilePhone session.
       
   613 	@return KErrNone if successful, a system wide error code if not.
       
   614  
       
   615 @capability None
       
   616 */
       
   617 	{
       
   618 	RSessionBase* session=&aPhone.SessionHandle();
       
   619 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
   620 	TInt subSessionHandle=aPhone.SubSessionHandle();
       
   621 	__ASSERT_ALWAYS(subSessionHandle!=NULL,PanicClient(EEtelPanicNullHandle));
       
   622 
       
   623 	TRAPD(ret,ConstructL()); 
       
   624 	if (ret)
       
   625 		return ret;
       
   626 	TPtrC name(KETelBroadcastMessaging);	
       
   627 	SetSessionHandle(*session);
       
   628 	TIpcArgs args(&name,TIpcArgs::ENothing,subSessionHandle);	
       
   629 	ret = CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
   630 	if (ret)
       
   631 		Destruct();
       
   632 	return ret;
       
   633 	}
       
   634 
       
   635 EXPORT_C void RMobileBroadcastMessaging::Close()
       
   636 /** This function member closes a RMobileBroadcastMessaging object. 
       
   637 @capability None
       
   638 */
       
   639  	{
       
   640 	CloseSubSession(EEtelClose);
       
   641 	Destruct();
       
   642 	}
       
   643 
       
   644 EXPORT_C void RMobileBroadcastMessaging::ConstructL()
       
   645 	{
       
   646 	__ASSERT_ALWAYS(iCbsMessagingPtrHolder==NULL,PanicClient(EEtelPanicHandleNotClosed));
       
   647 	iCbsMessagingPtrHolder = CCbsMessagingPtrHolder::NewL(CCbsMessagingPtrHolder::EMaxNumberBroadcastPtrSlots,CCbsMessagingPtrHolder::EMaxNumberBroadcastPtrCSlots);
       
   648 	}
       
   649 
       
   650 EXPORT_C void RMobileBroadcastMessaging::Destruct()
       
   651 /** Destructor. Deletes any dynamically allocated memory. */
       
   652 	{
       
   653 	delete iCbsMessagingPtrHolder;
       
   654 	iCbsMessagingPtrHolder = NULL;
       
   655 	ResetSessionHandle();
       
   656 	}
       
   657 
       
   658 EXPORT_C RMobileBroadcastMessaging::TMobileBroadcastCapsV1::TMobileBroadcastCapsV1() : 
       
   659 	iModeCaps(0), 
       
   660 	iFilterCaps(0)
       
   661 	{
       
   662 	iExtensionId=KETelExtMultimodeV1;
       
   663 	}
       
   664 
       
   665 EXPORT_C TInt RMobileBroadcastMessaging::GetCaps(TDes8& aCaps) const
       
   666 /**
       
   667 	This function member gets a class that reflects the broadcast messaging capabilities 
       
   668 	of the phone.
       
   669 	
       
   670 	@param aCaps On completion, a TMobileBroadcastCapsV1Pckg with the broadcast 
       
   671 	messaging capabilities.
       
   672 	@return KErrNone if successful, a system wide error code if not.
       
   673 	@see TMobileBroadcastCapsV1
       
   674  
       
   675 @capability None
       
   676 */
       
   677 	{
       
   678 	return Get(EMobileBroadcastMessagingGetCaps, aCaps);
       
   679 	}
       
   680 
       
   681 EXPORT_C RMobileBroadcastMessaging::TMobileBroadcastAttributesV1::TMobileBroadcastAttributesV1() :
       
   682 	iFlags(0), 
       
   683 	iFormat(EFormatUnspecified),
       
   684 	iServiceCategory(0)
       
   685 	{
       
   686 	iExtensionId=KETelExtMultimodeV1;
       
   687 	}
       
   688 
       
   689 /**
       
   690 	This is the initialization of the TMobileBroadcastAttributesV2 structured type
       
   691 	
       
   692 */
       
   693 EXPORT_C RMobileBroadcastMessaging::TMobileBroadcastAttributesV2::TMobileBroadcastAttributesV2() :	
       
   694 	TMobileBroadcastAttributesV1(),
       
   695 	iNumberOfPages(0),
       
   696 	iMessageType(0),
       
   697 	iMessageId(0),
       
   698 	iSerialNum(0),
       
   699 	iDCS(0)
       
   700 	/** Default constructor. All internal data is set to 0 and the extension ID to 
       
   701 	KETelExtMultimodeV2. */
       
   702 	{
       
   703 	iExtensionId=KETelExtMultimodeV2;
       
   704 	}
       
   705 
       
   706 
       
   707 /**
       
   708 	This function member enables the client to receive the next 
       
   709 	incoming broadcast message from the network.
       
   710 	
       
   711 	The request will be completed when a new message arrives. The
       
   712 	client will pass a descriptor of size KBroadcastPageSize bytes, 
       
   713 	provided by the typedef TBroadcastPageData, to hold the returned
       
   714 	broadcast message data into the aMsgData parameter.
       
   715 	
       
   716 	This buffer size should be used for all types of messages:
       
   717 	GSM, CDMA and WCDMA.
       
   718 	
       
   719 	The function explicity checks that the aMsgData parameter is of
       
   720 	size KBroadcastPageSize.  If the buffer size does not equal 
       
   721 	KBroadcastPageSize, the client request will be completed with
       
   722 	KErrArgument.
       
   723 	
       
   724 	A TSY should handle ReceiveMessage() requests by making them repost
       
   725 	immediately (to ensure none are missed) and possibly multiple 
       
   726 	completion enabled. When a new message arrives the TSY will copy the
       
   727 	broadcast message contents into its stored pointer to the broadcast 
       
   728 	message data, fill in the broadcast message attributes and then 
       
   729 	complete the request.
       
   730 	
       
   731 	@param aReqStatus On return, KErrNone if successful, KErrArgument if the aMsgData buffer size does not equal KBroadcastPageSize, otherwise a system wide error code.
       
   732 	@param aMsgData On completion, the message data.
       
   733 	@param aMsgAttributes On completion, the broadcast message attributes, in an instance of the TMobileBroadcastAttributesV1Pckg class.
       
   734 	@see TMobileBroadcastAttributesV1
       
   735  
       
   736 @capability None
       
   737 */
       
   738 EXPORT_C void RMobileBroadcastMessaging::ReceiveMessage(TRequestStatus& aReqStatus, TDes8& aMsgData, TDes8& aMsgAttributes) const
       
   739 	{
       
   740 	if (aMsgData.MaxLength() != KBroadcastPageSize)
       
   741 		{
       
   742 		TRequestStatus* status=&aReqStatus;
       
   743 		User::RequestComplete(status,KErrArgument);
       
   744 		return;
       
   745 		}
       
   746 	Get(EMobileBroadcastMessagingReceiveMessage, aReqStatus, aMsgData, aMsgAttributes);
       
   747 	}
       
   748 
       
   749 EXPORT_C TInt RMobileBroadcastMessaging::GetFilterSetting(TMobilePhoneBroadcastFilter& aSetting) const
       
   750 /**
       
   751 	This function member gets the current setting for the receipt of broadcast 
       
   752 	messages.
       
   753 	
       
   754 	This setting will indicate whether all or no messages are being accepted or 
       
   755 	whether only those messages specified by the filters are going to be accepted 
       
   756 	or rejected.
       
   757 	
       
   758 	If the returned setting, aSetting, equals EBroadcastAcceptFilter then the 
       
   759 	phone will accept messages whose identifier is included within the identifier 
       
   760 	list AND whose language is included within the language filter. If the returned 
       
   761 	setting, aSetting, equals EBroadcastRejectFilter then the phone will reject 
       
   762 	messages whose identifier is included within the identifier list OR whose 
       
   763 	language is included within the language filter.
       
   764 	
       
   765 	N.B. If the phone supports both GSM/WCDMA and CDMA mode then it will probably 
       
   766 	need two identifier lists - one to contain a list of CBMI (for GSM/WCDMA mode) 
       
   767 	and the other to contain a list of Service Categories (for CDMA mode) This 
       
   768 	function member is synchronous because it is expected that this will be a 
       
   769 	TSY specific setting whose current value the TSY has previously determined.
       
   770 	
       
   771 	@param aSetting On completion, the current filter settings.
       
   772 	@return KErrNone if successful, or KErrNotSupported if the phone does not support 
       
   773 	a filter setting.
       
   774  
       
   775 @capability ReadUserData
       
   776 */
       
   777 	{
       
   778 	TPckg<TMobilePhoneBroadcastFilter> ptr1(aSetting);
       
   779 	return Get(EMobileBroadcastMessagingGetFilterSetting, ptr1);
       
   780 	}
       
   781 
       
   782 EXPORT_C void RMobileBroadcastMessaging::SetFilterSetting(TRequestStatus& aReqStatus, TMobilePhoneBroadcastFilter aSetting) const
       
   783 /**
       
   784 	This function member sets a new setting for the receipt of broadcast messages.
       
   785 	
       
   786 	This setting will specify whether all or no messages are being accepted or 
       
   787 	whether only those messages specified by the filters are going to be accepted 
       
   788 	or rejected.
       
   789 	
       
   790 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingSetFilterSetting) 
       
   791 	to cancel a previously placed asynchronous SetFilterSetting() request.
       
   792 	
       
   793 	@param aReqStatus On return, the KErrNone if successful, KErrNotSupported 
       
   794 	if the phone does not support a filter setting. 
       
   795 	@param aSetting On completion, the new filter setting of the phone.
       
   796  
       
   797 @capability WriteUserData
       
   798 */
       
   799 	{
       
   800 	__ASSERT_ALWAYS(iCbsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   801 
       
   802 	iCbsMessagingPtrHolder->iSetFilterSetting=aSetting;
       
   803 
       
   804 	TPtrC8& ptr1=iCbsMessagingPtrHolder->SetC(CCbsMessagingPtrHolder::ESlot1SetFilterSetting, iCbsMessagingPtrHolder->iSetFilterSetting);
       
   805 	
       
   806 	Set(EMobileBroadcastMessagingSetFilterSetting, aReqStatus, ptr1);
       
   807 	}
       
   808 
       
   809 EXPORT_C void RMobileBroadcastMessaging::NotifyFilterSettingChange(TRequestStatus& aReqStatus, TMobilePhoneBroadcastFilter& aSetting) const
       
   810 /**
       
   811 	This function member allows a client to be notified if there is a change in 
       
   812 	the setting for the receipt of broadcast messages.
       
   813 	
       
   814 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingNotifyFilterSettingChange) 
       
   815 	to cancel a previously placed asynchronous NotifyFilterSetting() request.
       
   816 	
       
   817 	@param aReqStatus On return, KErrNone if successful, KErrNotSupported if the 
       
   818 	phone does not support a filter setting.
       
   819 	@param aSetting On completion, the changed filter setting.
       
   820  
       
   821 @capability ReadUserData
       
   822 */
       
   823 	{
       
   824 	__ASSERT_ALWAYS(iCbsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   825 
       
   826 	TPtr8& ptr1=iCbsMessagingPtrHolder->Set(CCbsMessagingPtrHolder::ESlot1NotifyFilterSettingChange,aSetting);
       
   827 
       
   828 	Get(EMobileBroadcastMessagingNotifyFilterSettingChange, aReqStatus, ptr1);
       
   829 	}
       
   830 
       
   831 EXPORT_C void RMobileBroadcastMessaging::GetLanguageFilter(TRequestStatus& aReqStatus, TDes16& aLangFilter) const
       
   832 /**
       
   833 	This function member allows a client to retrieve the current contents of the 
       
   834 	broadcast message language filter.
       
   835 	
       
   836 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingGetLanguageFilter) 
       
   837 	to cancel a previously placed asynchronous GetLanguageFilter() request.
       
   838 	
       
   839 	@param aReqStatus On return KErrNone if successful, KErrNotFound if there 
       
   840 	is no language filter in place, and KErrNotSupported if the phone does not 
       
   841 	support a language filter.
       
   842 	@param aLangFilter On completion, contain as many languages (each coded on 
       
   843 	16-bits) as can fit in the descriptor supplied by the client. This filter 
       
   844 	defines which are the desired (or undesired) language(s) of incoming broadcast 
       
   845 	messages. A language is defined either within one byte by its Cell Broadcast 
       
   846 	Data Coding Scheme (as defined in GSM 03.38) or within two bytes by its ISO 
       
   847 	639 alphanumeric pair. Even if a language is represented by an 8-bit value 
       
   848 	it will be returned as a 16-bit value with the language in the least significant 
       
   849 	8-bits.
       
   850  
       
   851 @capability ReadUserData
       
   852 */
       
   853 	{
       
   854 	Get(EMobileBroadcastMessagingGetLanguageFilter,aReqStatus,aLangFilter);
       
   855 	}
       
   856 
       
   857 EXPORT_C void RMobileBroadcastMessaging::SetLanguageFilter(TRequestStatus& aReqStatus, const TDesC16& aLangFilter) const
       
   858 /**
       
   859 	This function member allows a client to store new contents for the broadcast 
       
   860 	message language filter.
       
   861 	
       
   862 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingSetLanguageFilter) 
       
   863 	to cancel a previously placed asynchronous SetLanguageFilter() request.
       
   864 	
       
   865 	@param aReqStatus On return, KErrNone, if successful, KErrNotSupported if 
       
   866 	the phone does not support a language filter.
       
   867 	@param aLangFilter Each element in this descriptor will define a language. 
       
   868 	This filter will define which are the desired (or undesired) language(s) of 
       
   869 	incoming broadcast messages.
       
   870  
       
   871 @capability WriteUserData
       
   872 */
       
   873 	{
       
   874 	Set(EMobileBroadcastMessagingSetLanguageFilter,aReqStatus,aLangFilter);
       
   875 	}
       
   876 
       
   877 EXPORT_C void RMobileBroadcastMessaging::NotifyLanguageFilterChange(TRequestStatus& aReqStatus, TDes16& aLangFilter) const
       
   878 /**
       
   879 	This function member allows a client to be notified if there is a change in 
       
   880 	the contents of the language filter.
       
   881 	
       
   882 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingNotifyLanguageFilterChange) 
       
   883 	to cancel a previously placed asynchronous NotifyLanguageFilterChange() request.
       
   884 	
       
   885 	@param aReqStatus On return, KErrNone, if successful, KErrNotSupported if 
       
   886 	the phone does not support a language filter.
       
   887 	@param aLangFilter On completion, the new language filter.
       
   888  
       
   889 @capability ReadUserData
       
   890 */
       
   891 	{
       
   892 	Get(EMobileBroadcastMessagingNotifyLanguageFilterChange,aReqStatus,aLangFilter);
       
   893 	}
       
   894 
       
   895 EXPORT_C RMobileBroadcastMessaging::TMobileBroadcastIdEntryV1::TMobileBroadcastIdEntryV1() :
       
   896 	iId(0)
       
   897 	{
       
   898 	iExtensionId=KETelExtMultimodeV1;
       
   899 	}
       
   900 
       
   901 void RMobileBroadcastMessaging::TMobileBroadcastIdEntryV1::InternalizeL(RReadStream& aStream)
       
   902 /** Internalizes the CBMI entry from a stream.
       
   903 
       
   904 	@param aStream The read stream containing the CBMI entry.
       
   905  */
       
   906 	{
       
   907 	TMultimodeType::InternalizeL(aStream);
       
   908 	iId = aStream.ReadUint16L();
       
   909 	}
       
   910 
       
   911 void RMobileBroadcastMessaging::TMobileBroadcastIdEntryV1::ExternalizeL(RWriteStream& aStream) const
       
   912 /** Externalizes the CBMI entry into a stream.
       
   913 	
       
   914 	@param aStream The write stream that will contain the CBMI entry.
       
   915  */
       
   916 	{
       
   917 	TMultimodeType::ExternalizeL(aStream);
       
   918 	aStream.WriteInt16L(iId);
       
   919 	}
       
   920 
       
   921 EXPORT_C void RMobileBroadcastMessaging::StoreBroadcastIdListL(TRequestStatus& aReqStatus, CMobilePhoneBroadcastIdList* aBroadcastIdList, TMobileBroadcastIdType aIdType)
       
   922 /**
       
   923 	This function member may be used to store a new version of the entire BroadcastId list 
       
   924 	of identifier entries.
       
   925 	
       
   926 	The list, should not contain more entries than can be stored phone-side. This 
       
   927 	function member will store all the identifier list entries into the phone-side 
       
   928 	storage. It will overwrite the current contents of the storage and may cause 
       
   929 	other clients to be notified of the change in identifier list.
       
   930 	
       
   931 	Due to the probable time taken to store a list, there is only an asynchronous 
       
   932 	version of this function member. This function member will leave if an out 
       
   933 	of memory error occurs during allocation of a client-side buffer in which 
       
   934 	to store the streamed list contents. 
       
   935 	
       
   936 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingStoreIdList) 
       
   937 	to cancel a previously placed asynchronous StoreBroadcastIdListL() request.
       
   938 	Will leave if the CBufFlat to hold the streamed contents can not be allocated
       
   939 	
       
   940 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   941 	if not.
       
   942 	@param aBroadcastIdList The list of BroadcastId identifier entries to be stored.
       
   943 	@param aIdType Specifies whether the list is to be stored as a GSM/WCDMA list 
       
   944 	of CBMI entries or a CDMA list of Service Category entries.
       
   945  
       
   946 @capability WriteUserData
       
   947 */
       
   948 	{
       
   949 	__ASSERT_ALWAYS(aBroadcastIdList!=NULL,PanicClient(EEtelPanicNullHandle));
       
   950 	__ASSERT_ALWAYS(iCbsMessagingPtrHolder!=NULL,PanicClient(EEtelPanicNullHandle));
       
   951 
       
   952 	delete iCbsMessagingPtrHolder->iBroadcastIdBuf;
       
   953 	iCbsMessagingPtrHolder->iBroadcastIdBuf = NULL;
       
   954 
       
   955 	iCbsMessagingPtrHolder->iBroadcastIdBuf=aBroadcastIdList->StoreLC();
       
   956 	CleanupStack::Pop();
       
   957 
       
   958 	(iCbsMessagingPtrHolder->iBroadcastIdPtr).Set((iCbsMessagingPtrHolder->iBroadcastIdBuf)->Ptr(0));
       
   959 
       
   960 	iCbsMessagingPtrHolder->iIdType = aIdType;
       
   961 	TPtrC8& ptr2=iCbsMessagingPtrHolder->SetC(CCbsMessagingPtrHolder::ESlot1StoreBroadcastIdListL,iCbsMessagingPtrHolder);
       
   962 
       
   963 	Set(EMobileBroadcastMessagingStoreIdList,aReqStatus,iCbsMessagingPtrHolder->iBroadcastIdPtr, ptr2);
       
   964 	}
       
   965 
       
   966 EXPORT_C void RMobileBroadcastMessaging::NotifyBroadcastIdListChange(TRequestStatus& aReqStatus) const
       
   967 /**
       
   968 	This function member allows a client to be notified that changes have been 
       
   969 	made to the BroadcastId filter identifier list.
       
   970 	
       
   971 	When it completes, it does not return the new version of the list so the client 
       
   972 	will have to retrieve the list using CRetrieveMobilePhoneBroadcastIdL again if it is interested in the new list.
       
   973 
       
   974 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileBroadcastMessagingNotifyIdListChange) 
       
   975 	to cancel a previously placed asynchronous NotifyBroadcastIdListChange() request.
       
   976 
       
   977 	@param aReqStatus On return, KErrNone if successful, a system wide error code 
       
   978 	if not.
       
   979  
       
   980 @capability None
       
   981 */
       
   982 	{
       
   983 	Blank(EMobileBroadcastMessagingNotifyIdListChange,aReqStatus);
       
   984 	}
       
   985 
       
   986 /************************************************************************/
       
   987 //
       
   988 //  RMobileUssdMessaging
       
   989 //
       
   990 /************************************************************************/
       
   991 
       
   992 EXPORT_C RMobileUssdMessaging::RMobileUssdMessaging()
       
   993 : iUssdMessagingPtrHolder(NULL)
       
   994 /** Constructor. */
       
   995 	{
       
   996 	}
       
   997 
       
   998 EXPORT_C TInt RMobileUssdMessaging::Open(RMobilePhone& aPhone)
       
   999 /**
       
  1000 	This member function opens a USSD messaging sub-session. The name of the sub-session 
       
  1001 	opened in the TSY will equal the string defined by the KETelUssdMessaging 
       
  1002 	LIT definition.
       
  1003 	
       
  1004 	@param aPhone An existing RMobilePhone session.
       
  1005 	@return KErrNone if successful.
       
  1006  
       
  1007 @capability None
       
  1008 */
       
  1009 	{
       
  1010 	RSessionBase* session=&aPhone.SessionHandle();
       
  1011 	__ASSERT_ALWAYS(session!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1012 	TInt subSessionHandle=aPhone.SubSessionHandle();
       
  1013 	__ASSERT_ALWAYS(subSessionHandle!=NULL,PanicClient(EEtelPanicNullHandle));
       
  1014 
       
  1015 	TRAPD(ret,ConstructL()); 
       
  1016 	if (ret)
       
  1017 		return ret;
       
  1018 	TPtrC name(KETelUssdMessaging);	
       
  1019 	SetSessionHandle(*session);
       
  1020 	TIpcArgs args(&name,TIpcArgs::ENothing,subSessionHandle);	
       
  1021 	ret = CreateSubSession(*session,EEtelOpenFromSubSession,args);
       
  1022 	if (ret)
       
  1023 		Destruct();
       
  1024 	return ret;
       
  1025 	}
       
  1026 
       
  1027 EXPORT_C void RMobileUssdMessaging::Close()
       
  1028 /** This member function closes a USSD Messaging object. 
       
  1029 @capability None
       
  1030 */
       
  1031  	{
       
  1032 	CloseSubSession(EEtelClose);
       
  1033 	Destruct();
       
  1034 	}
       
  1035 
       
  1036 EXPORT_C void RMobileUssdMessaging::ConstructL()
       
  1037 	{
       
  1038 	}
       
  1039 
       
  1040 EXPORT_C void RMobileUssdMessaging::Destruct()
       
  1041 /** Destructor. */
       
  1042 	{
       
  1043 	}
       
  1044 
       
  1045 EXPORT_C RMobileUssdMessaging::TMobileUssdCapsV1::TMobileUssdCapsV1() : 
       
  1046 	iUssdFormat(0), 
       
  1047 	iUssdTypes(0)
       
  1048 	{
       
  1049 	iExtensionId=KETelExtMultimodeV1;
       
  1050 	}
       
  1051 
       
  1052 EXPORT_C TInt RMobileUssdMessaging::GetCaps(TDes8& aCaps) const
       
  1053 /**
       
  1054 	This member function returns a class that reflects the USSD messaging capabilities 
       
  1055 	of the phone.
       
  1056 	
       
  1057 	@param aCaps On completion, a TMobileUssdCapsV1Pckg with the current USSD 
       
  1058 	messaging capabilities.
       
  1059 	@return KErrNone if successful.
       
  1060 	@see TMobileUssdCapsV1
       
  1061  
       
  1062 @capability None
       
  1063 */
       
  1064 	{
       
  1065 	return Get(EMobileUssdMessagingGetCaps, aCaps);
       
  1066 	}
       
  1067 
       
  1068 EXPORT_C RMobileUssdMessaging::TMobileUssdAttributesV1::TMobileUssdAttributesV1() :
       
  1069 	iFlags(0), 
       
  1070 	iFormat(EFormatUnspecified), 
       
  1071 	iType(EUssdUnknown), 
       
  1072 	iDcs(0)
       
  1073 	{
       
  1074 	iExtensionId=KETelExtMultimodeV1;
       
  1075 	}
       
  1076 
       
  1077 EXPORT_C void RMobileUssdMessaging::ReceiveMessage(TRequestStatus& aReqStatus, TDes8& aMsgData, TDes8& aMsgAttributes) const
       
  1078 /**
       
  1079 	This member function enables the client to receive the next incoming USSD message 
       
  1080 	from the network. The request will be completed when a new message arrives.
       
  1081 	
       
  1082 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileUssdMessagingReceiveMessage) 
       
  1083 	to cancel a previously placed asynchronous ReceiveMessage() request.
       
  1084 	
       
  1085 	@param aReqStatus On return, KErrNone if successful.
       
  1086 	@param aMsgData A descriptor large enough to hold the returned USSD message 
       
  1087 	data. For GSM/ WCDMA USSD messages this will be a buffer of 160 bytes and 
       
  1088 	the clients are provided with a typedef called RMobileUssdMessaging::TGsmUssdMessageData.
       
  1089 	@param aMsgAttributes On completion, the TMobileUssdAttributesV1Pckg with the 
       
  1090 	message attributes.
       
  1091  
       
  1092 	@see TMobileUssdAttributesV1
       
  1093 
       
  1094 @capability ReadDeviceData
       
  1095 @capability NetworkControl
       
  1096 */
       
  1097 	{
       
  1098 	Get(EMobileUssdMessagingReceiveMessage, aReqStatus, aMsgData, aMsgAttributes);
       
  1099 	}
       
  1100 
       
  1101 EXPORT_C void RMobileUssdMessaging::SendMessage(TRequestStatus& aReqStatus, const TDesC8& aMsgData, const TDesC8& aMsgAttributes) const
       
  1102 /**
       
  1103 	This member function sends a USSD message to the network.
       
  1104 
       
  1105 	See	3GPP spec. 04.90 for more details on expected responses from
       
  1106 	the network.
       
  1107 	
       
  1108 	Use RTelSubSessionBase::CancelAsyncRequest(EMobileUssdMessagingSendMessage) 
       
  1109 	to cancel a previously placed asynchronous SendMessage() request.
       
  1110 	
       
  1111 	@param aReqStatus On return, KErrNone if successful.
       
  1112 	@param aMsgData The message data.
       
  1113 	@param aMsgAttributes The TMobileUssdAttributesV1Pckg with the message attributes.
       
  1114 
       
  1115 	@see TMobileUssdAttributesV1
       
  1116 
       
  1117 @capability NetworkServices
       
  1118 @capability WriteDeviceData
       
  1119 @capability NetworkControl
       
  1120 */
       
  1121 	{
       
  1122 	Set(EMobileUssdMessagingSendMessage, aReqStatus, aMsgData, aMsgAttributes);
       
  1123 	}
       
  1124 
       
  1125 EXPORT_C void RMobileUssdMessaging::SendMessageNoFdnCheck(TRequestStatus& aReqStatus, const TDesC8& aMsgData, const TDesC8& aMsgAttributes) const
       
  1126 /**
       
  1127 	Sends an outgoing USSD to the network. 
       
  1128 	
       
  1129 	The number used for sending the SMS is not checked against those 
       
  1130 	in the Fixed Dialling Number list even if the FDN service is enabled.
       
  1131 	
       
  1132 	@param aMsgData Supplies the USSD message data to send
       
  1133 	@param aMsgAttributes Supplies the attributes of the outgoing USSD
       
  1134  
       
  1135 @capability NetworkServices
       
  1136 @capability NetworkControl
       
  1137 @capability WriteDeviceData
       
  1138 */
       
  1139 	{
       
  1140 	Set(EMobileUssdMessagingSendMessageNoFdnCheck, aReqStatus, aMsgData, aMsgAttributes);
       
  1141 	}
       
  1142 
       
  1143 EXPORT_C void RMobileUssdMessaging::SendRelease(TRequestStatus& aReqStatus, TDes8& aReturnResult) const
       
  1144 /**
       
  1145 	Sends a USSD release message to the network.  This request can terminate an ongoing "dialogue" (send-receive) at any time.
       
  1146 	
       
  1147 	@param aReqStatus Returns the result code after the asynchronous call completes.
       
  1148 	@param aReturnResult A packaged instance of the RMobilePhone::TMobilePhoneSendSSRequestV3 class containing the result of the release.
       
  1149 
       
  1150 @capability NetworkServices
       
  1151 @capability NetworkControl
       
  1152 */
       
  1153 	{
       
  1154 	Get(EMobileUssdMessagingSendRelease, aReqStatus, aReturnResult);
       
  1155 	}
       
  1156 	
       
  1157 EXPORT_C void RMobileUssdMessaging::NotifyNetworkRelease(TRequestStatus& aReqStatus, TDes8& aReturnResult) const
       
  1158 /**
       
  1159 	Notifies the client of a MT USSD release message to the mobile device.  The notification completes when a release
       
  1160 	message to terminate the session has been received and successfully acknowledged.  
       
  1161     NB: This fucntion has been deprecated and it is not recommended for future development work. 
       
  1162 	
       
  1163 	@param aReqStatus Returns the result code after the asynchronous call completes.
       
  1164 	@param aReturnResult A packaged instance of the RMobilePhone::TMobilePhoneSendSSRequestV3 class containing the result of the release.
       
  1165 
       
  1166 @capability None
       
  1167 */
       
  1168 	{
       
  1169 	Get(EMobileUssdMessagingNotifyNetworkRelease, aReqStatus, aReturnResult);
       
  1170 	}
       
  1171 
       
  1172 EXPORT_C void RMobileUssdMessaging::NotifyNetworkRelease(TRequestStatus& aReqStatus, TDes8& aMsgData, TDes8& aMsgAttributes) const
       
  1173 /**
       
  1174 	Notifies the client of a MT USSD release message to the mobile device.  The notification completes when a release
       
  1175 	message to terminate the session has been received and successfully acknowledged.  
       
  1176  
       
  1177 	@param aReqStatus Returns the result code after the asynchronous call completes.
       
  1178 	@param aMsgData A packaged instance of the RMobilePhone::TMobilePhoneSendSSRequestV3 class containing the result of the release.
       
  1179     @param aMsgAttributes A packaged instance of the TMobileUssdAttributesV1Pckg class containing the message attributes.
       
  1180 
       
  1181 	@see TMobileUssdAttributesV1
       
  1182 
       
  1183 @capability None
       
  1184 */
       
  1185 	{
       
  1186 	Get(EMobileUssdMessagingNotifyNetworkRelease, aReqStatus, aMsgData, aMsgAttributes);
       
  1187 	}
       
  1188