cbsref/telephonyrefplugins/atltsy/handler/src/cltsysmshandler.cpp
branchRCL_3
changeset 65 630d2f34d719
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
       
     1 // Copyright (c) 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 // CLtsySmsHandler/
       
    15 
       
    16 #include <ctsy/ltsy/cctsydispatchercallback.h>
       
    17 #include <mmtsy_ipcdefs.h>
       
    18 
       
    19 
       
    20 
       
    21 #include "cltsysmshandler.h"
       
    22 #include <ctsy/ltsy/ltsylogger.h>
       
    23 #include "ltsymacros.h"
       
    24 #include "globalphonemanager.h"
       
    25 #include "atmessagestoreinfo.h"
       
    26 #include "atsmssend.h"
       
    27 #include "atsmsreceive.h"
       
    28 #include "atsmsack.h"
       
    29 #include "mslogger.h"
       
    30 #include "asynchelperrequest.h"
       
    31 CLtsySmsHandler::CLtsySmsHandler(CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    32 	:iCtsyDispatcherCallback(aCtsyDispatcherCallback),iGloblePhone(aGloblePhone)
       
    33 	{
       
    34 	
       
    35 	}
       
    36 
       
    37 	
       
    38 CLtsySmsHandler::~CLtsySmsHandler()
       
    39 	{
       
    40 	if ( iAtSmsReceive )
       
    41 		{
       
    42 	    delete iAtSmsReceive;
       
    43 		}
       
    44 	}
       
    45 
       
    46 
       
    47 CLtsySmsHandler* CLtsySmsHandler::NewLC(
       
    48 	CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    49 	{
       
    50 	TSYLOGENTRYEXIT;
       
    51 	CLtsySmsHandler* self = new (ELeave) CLtsySmsHandler(aCtsyDispatcherCallback,aGloblePhone);
       
    52 	CleanupStack::PushL(self);
       
    53 	self->ConstructL();
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 
       
    58 CLtsySmsHandler* CLtsySmsHandler::NewL(
       
    59 	CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    60 	{
       
    61 	TSYLOGENTRYEXIT;
       
    62 	CLtsySmsHandler* self=
       
    63 			CLtsySmsHandler::NewLC(aCtsyDispatcherCallback,aGloblePhone);
       
    64 	CleanupStack::Pop(self);
       
    65 	return self;
       
    66 	}
       
    67 
       
    68 
       
    69 void CLtsySmsHandler::ConstructL()
       
    70 /**
       
    71  * Second phase constructor.
       
    72  */
       
    73 	{
       
    74 	TSYLOGENTRYEXIT;
       
    75 	iAsyncHelperRequest = CAsyncHelperRequest::NewL((*iGloblePhone), iCtsyDispatcherCallback);
       
    76 	iAtSmsReceive = CAtSmsReceive::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
    77 	iAtSmsReceive->StartRequest();
       
    78 
       
    79 	} // CLtsySmsHandler::ConstructL
       
    80 
       
    81 TBool CLtsySmsHandler::IsInterfaceSupported(TLtsyDispatchInterfaceApiId aDispatchApiId)
       
    82 /**
       
    83  * Returns whether a Dispatch Interface APi is supported or not.
       
    84  * 
       
    85  * @param aDispatchApiId Id of Dispatch interface being queried
       
    86  * @return indication whether interface is supported or not
       
    87  */
       
    88 	{
       
    89 	switch(aDispatchApiId)
       
    90 		{
       
    91 		// Insert ApiIds when support is provided in LTSY 
       
    92 		case KLtsyDispatchSmsGetSmsStoreInfoApiId:
       
    93 		    return ETrue;
       
    94 		case KLtsyDispatchSmsNackSmsStoredApiId:
       
    95 			return ETrue;
       
    96 		case KLtsyDispatchSmsAckSmsStoredApiId:
       
    97 			return ETrue;
       
    98 		case KLtsyDispatchSmsSendSmsMessageApiId:
       
    99 			return ETrue;
       
   100 		case KLtsyDispatchSmsSetMoSmsBearerApiId:
       
   101 			return ETrue;
       
   102 		default:
       
   103 			return EFalse;
       
   104 		}
       
   105 	}
       
   106 
       
   107 void CLtsySmsHandler::IsCallbackIndicatorSupported(TLtsyDispatchIndIdGroup aIdGroup, TUint32& aIndIdBitMask)
       
   108 /**
       
   109  * Returns the set of callback indicators that are supported.
       
   110  * 
       
   111 * @param aIdGroup ID of group that is being queried e.g. aIdGroup=EIndIdGroup1
       
   112 * @param aIndIdBitMask [out] argument that should return a bitmask indicating which indicator callbacks are supported.
       
   113  */
       
   114 	{
       
   115 	//Create bitmask with bitset for each indicator ID that is supported. E.g.
       
   116 	
       
   117 	if(aIdGroup == EIndIdGroup1)
       
   118 		aIndIdBitMask = KLtsyDispatchSmsNotifyReceiveSmsMessageIndId;
       
   119 	else
       
   120 		aIndIdBitMask = 0; //no indicators from other groups supported
       
   121 	
       
   122 	}
       
   123 
       
   124 
       
   125 TInt CLtsySmsHandler::HandleSendSatSmsReqL( const TDesC8& /*aSmsTpdu*/,
       
   126 		   RMobileSmsMessaging::TMobileSmsDataFormat /*aDataFormat*/,
       
   127 		   const RMobilePhone::TMobileAddress& /*aGsmServiceCentre*/,
       
   128 		   TBool /*aMoreMessages*/
       
   129 		  )
       
   130 /**
       
   131  * This request is completed by invoking
       
   132  * CCtsyDispatcherCallback::CallbackSmsSendSatSmsComp
       
   133  *
       
   134  * @param aDestination The mobile telephone number.
       
   135  * @param aSmsTpdu The SMS TPDU.
       
   136  * @param aDataFormat The SMS data format.
       
   137  * @param aGsmServiceCentre The service centre number.
       
   138  * @param aMore  This indicates whether the client is going to send another SMS immediately 
       
   139 	                 after this one.
       
   140  *
       
   141  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   142  * or another error code to indicate the failure otherwise.
       
   143  */
       
   144 	{
       
   145 	TSYLOGENTRYEXIT;
       
   146 
       
   147 	TInt ret = KErrNotSupported;
       
   148 
       
   149 	// TODO: Add implementation here.......
       
   150 
       
   151 
       
   152 
       
   153 	return TSYLOGSETEXITERR(ret);
       
   154 	} // CLtsySmsHandler::HandleSendSatSmsReqL
       
   155 
       
   156 
       
   157 TInt CLtsySmsHandler::HandleGetSmsStoreInfoReqL(/* TODO: Add correct parameteres here */)
       
   158 /**
       
   159  * This request is completed by invoking
       
   160  * CCtsyDispatcherCallback::CallbackSmsGetSmsStoreInfoComp
       
   161  *
       
   162  * @param TODO: Add parameter in-source documentation here
       
   163  *
       
   164  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   165  * or another error code to indicate the failure otherwise.
       
   166  */
       
   167 	{
       
   168 	TSYLOGENTRYEXIT;
       
   169 
       
   170 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   171 	if( KErrNone == ret )
       
   172 		{
       
   173 		CAtMessageStoreInfo* atMessageStoreInfo = CAtMessageStoreInfo::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   174 		//Setting Port active
       
   175 		iGloblePhone->iEventSignalActive = ETrue;
       
   176 		iGloblePhone->SetActiveRequest(atMessageStoreInfo);
       
   177 		atMessageStoreInfo->StartRequest();
       
   178 		}
       
   179 
       
   180 	return TSYLOGSETEXITERR(ret);
       
   181 	} // CLtsySmsHandler::HandleGetSmsStoreInfoReqL
       
   182 
       
   183 
       
   184 TInt CLtsySmsHandler::HandleGetSmspListReqL()
       
   185 /**
       
   186  * This request is completed by invoking
       
   187  * CCtsyDispatcherCallback::CallbackSmsGetSmspListComp
       
   188  *
       
   189  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   190  * or another error code to indicate the failure otherwise.
       
   191  */
       
   192 	{
       
   193 	TSYLOGENTRYEXIT;
       
   194 
       
   195 	TInt ret = KErrNotSupported;
       
   196 
       
   197 	// TODO: Add implementation here.......
       
   198 
       
   199 
       
   200 	return TSYLOGSETEXITERR(ret);
       
   201 	} // CLtsySmsHandler::HandleGetSmspListReqL
       
   202 
       
   203 
       
   204 TInt CLtsySmsHandler::HandleNackSmsStoredReqL(const TDesC8& aMsgPtr, TInt /*aRpCause*/)
       
   205 /**
       
   206  * This request is completed by invoking
       
   207  * CCtsyDispatcherCallback::CallbackSmsNackSmsStoredComp
       
   208  *
       
   209  * @param aMsgPtr Reference to TPDU data.
       
   210  * @param aRpCause RP cause.
       
   211  *
       
   212  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   213  * or another error code to indicate the failure otherwise.
       
   214  */
       
   215 	{
       
   216 	TSYLOGENTRYEXIT;
       
   217 
       
   218 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   219 	if( KErrNone == ret )
       
   220 		{
       
   221 		CAtSmsNack* atSmsNack = CAtSmsNack::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   222 		//Setting Port active
       
   223 		iGloblePhone->iEventSignalActive = ETrue;
       
   224 		atSmsNack->SetNackTpdu(aMsgPtr);
       
   225 		iGloblePhone->SetActiveRequest(atSmsNack);
       
   226 		atSmsNack->StartRequest();
       
   227 		}
       
   228 
       
   229 	return TSYLOGSETEXITERR(ret);
       
   230 	} // CLtsySmsHandler::HandleNackSmsStoredReqL
       
   231 
       
   232 TInt CLtsySmsHandler::HandleNackSmsStoredReqL( TInt /*aRpCause*/)
       
   233 /**
       
   234  * This request is completed by invoking
       
   235  * CCtsyDispatcherCallback::CallbackSmsNackSmsStoredComp
       
   236  *
       
   237  * @param aMsgPtr Reference to TPDU data.
       
   238  * @param aRpCause RP cause.
       
   239  *
       
   240  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   241  * or another error code to indicate the failure otherwise.
       
   242  */
       
   243     {
       
   244     TSYLOGENTRYEXIT;
       
   245 
       
   246     TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   247     if( KErrNone == ret )
       
   248         {
       
   249         CAtSmsNack* atSmsNack = CAtSmsNack::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   250         //Setting Port active
       
   251         iGloblePhone->iEventSignalActive = ETrue;
       
   252         //atSmsNack->SetNackTpdu(aMsgPtr);
       
   253         iGloblePhone->SetActiveRequest(atSmsNack);
       
   254         atSmsNack->StartRequest();
       
   255         }
       
   256 
       
   257     return TSYLOGSETEXITERR(ret);
       
   258     } // CLtsySmsHandler::HandleNackSmsStoredReqL
       
   259 
       
   260 TInt CLtsySmsHandler::HandleAckSmsStoredReqL(const TDesC8& /*aMsgPtr*/)
       
   261 /**
       
   262  * This request is completed by invoking
       
   263  * CCtsyDispatcherCallback::CallbackSmsAckSmsStoredComp
       
   264  *
       
   265  * @param aMsgPtr Contains the TPDU defined for a SMS-DELIVER-REPORT.
       
   266  *
       
   267  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   268  * or another error code to indicate the failure otherwise.
       
   269  */
       
   270 	{
       
   271 	TSYLOGENTRYEXIT;
       
   272 
       
   273 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   274 	if( KErrNone == ret )
       
   275 		{
       
   276 		CAtSmsAck* atSmsAck = CAtSmsAck::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   277 		//Setting Port active
       
   278 		iGloblePhone->iEventSignalActive = ETrue;
       
   279 		iGloblePhone->SetActiveRequest(atSmsAck);
       
   280 		atSmsAck->StartRequest();
       
   281 		}
       
   282 	
       
   283 	return TSYLOGSETEXITERR(ret);
       
   284 	} // CLtsySmsHandler::HandleAckSmsStoredReqL
       
   285 
       
   286 TInt CLtsySmsHandler::HandleAckSmsStoredReqL()
       
   287 /**
       
   288  * This request is completed by invoking
       
   289  * CCtsyDispatcherCallback::CallbackSmsAckSmsStoredComp
       
   290  *
       
   291  *
       
   292  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   293  * or another error code to indicate the failure otherwise.
       
   294  */
       
   295     {
       
   296     TSYLOGENTRYEXIT;
       
   297 
       
   298     TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   299     if( KErrNone == ret )
       
   300         {
       
   301         CAtSmsAck* atSmsAck = CAtSmsAck::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   302         //Setting Port active
       
   303         iGloblePhone->iEventSignalActive = ETrue;
       
   304         iGloblePhone->SetActiveRequest(atSmsAck);
       
   305         atSmsAck->StartRequest();
       
   306         }
       
   307     
       
   308     return TSYLOGSETEXITERR(ret);
       
   309     }
       
   310 
       
   311 TInt CLtsySmsHandler::HandleResumeSmsReceptionReqL()
       
   312 /**
       
   313  * This request is completed by invoking
       
   314  * CCtsyDispatcherCallback::CallbackSmsResumeSmsReceptionComp
       
   315  *
       
   316  * @param TODO: Add parameter in-source documentation here
       
   317  *
       
   318  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   319  * or another error code to indicate the failure otherwise.
       
   320  */
       
   321 	{
       
   322 	TSYLOGENTRYEXIT;
       
   323 
       
   324 	TInt ret = KErrNotSupported;
       
   325 
       
   326 
       
   327 	return TSYLOGSETEXITERR(ret);
       
   328 	} // CLtsySmsHandler::HandleResumeSmsReceptionReqL
       
   329 
       
   330 
       
   331 TInt CLtsySmsHandler::HandleSendSmsMessageReqL( const RMobilePhone::TMobileAddress& aDestination,
       
   332 	     									    const TDesC8& aSmsTpdu,
       
   333 	     									    RMobileSmsMessaging::TMobileSmsDataFormat aDataFormat,
       
   334 	     										const RMobilePhone::TMobileAddress& aGsmServiceCentre,
       
   335 	     										TBool aMoreMessages
       
   336 	   										   ) 
       
   337 /**
       
   338  * This request is completed by invoking
       
   339  * CCtsyDispatcherCallback::CallbackSmsSendSmsMessageComp
       
   340  *
       
   341  * @param aDestination The mobile telephone number.
       
   342  * @param aSmsTpdu The SMS TPDU.
       
   343  * @param aDataFormat The SMS data format.
       
   344  * @param aGsmServiceCentre The service centre number.
       
   345  * @param aMore This indicates whether the client is going to send another SMS immediately 
       
   346 	            after this one. 
       
   347  *
       
   348  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   349  * or another error code to indicate the failure otherwise.
       
   350  */
       
   351 	{
       
   352 	TSYLOGENTRYEXIT;
       
   353 	if(aSmsTpdu.Length() > KGsmTpduSize)
       
   354 		{
       
   355 		return TSYLOGSETEXITERR(KErrArgument);
       
   356 		}
       
   357 	TSmsSendParam msgParam;
       
   358 	msgParam.iDataFormat = aDataFormat;
       
   359 	msgParam.iDestination = aDestination;
       
   360 	msgParam.iSmsTpdu = aSmsTpdu;
       
   361 	msgParam.iGsmServiceCentre = aGsmServiceCentre;
       
   362 	msgParam.iMoreMessages = aMoreMessages;
       
   363 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   364 	if( KErrNone == ret )
       
   365 		{
       
   366 		CAtSmsSend* atSmsSend = CAtSmsSend::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   367 		//Setting Port active
       
   368 		iGloblePhone->iEventSignalActive = ETrue;
       
   369 		iGloblePhone->SetActiveRequest(atSmsSend);
       
   370 		atSmsSend->SetMessageParam(msgParam);
       
   371 		atSmsSend->StartRequest();
       
   372 		}
       
   373 	return TSYLOGSETEXITERR(ret);
       
   374 	} // CLtsySmsHandler::HandleSendSmsMessageReqL
       
   375 
       
   376 TInt CLtsySmsHandler::HandleSendSmsMessageNoFdnCheckReqL( const RMobilePhone::TMobileAddress& /*aDestination*/,
       
   377 	     												  const TDesC8& /*aSmsTpdu*/,
       
   378 	     												  RMobileSmsMessaging::TMobileSmsDataFormat /*aDataFormat*/,
       
   379 	     												  const RMobilePhone::TMobileAddress& /*aGsmServiceCentre*/,
       
   380 	     												  TBool /*aMoreMessages*/
       
   381 	   													) 
       
   382 /**
       
   383  * This request is completed by invoking
       
   384  * CCtsyDispatcherCallback::CallbackSmsSendSmsMessageNoFdnCheckComp
       
   385  *
       
   386  * @param aDestination The mobile telephone number.
       
   387  * @param aSmsTpdu The SMS TPDU.
       
   388  * @param aDataFormat The SMS data format.
       
   389  * @param aGsmServiceCentre The service centre number.
       
   390  * @param aMore This indicates whether the client is going to send another SMS immediately 
       
   391 	            after this one. 
       
   392 	                 
       
   393  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   394  * or another error code to indicate the failure otherwise.
       
   395  */
       
   396 	{
       
   397 	TSYLOGENTRYEXIT;
       
   398 
       
   399 	TInt ret = KErrNotSupported;
       
   400 
       
   401 	// TODO: Add implementation here.......
       
   402 	
       
   403 
       
   404 
       
   405 	return TSYLOGSETEXITERR(ret);
       
   406 	} // CLtsySmsHandler::HandleSendSmsMessageNoFdnCheckReqL
       
   407 
       
   408 TInt CLtsySmsHandler::HandleSetMoSmsBearerReqL(RMobileSmsMessaging::TMobileSmsBearer /*aBearer*/)
       
   409 /**
       
   410  * This request is completed by invoking
       
   411  * CCtsyDispatcherCallback::CallbackSmsSetMoSmsBearerComp
       
   412  *
       
   413  * 
       
   414  * @param aBearer The SMS bearer.
       
   415  * 
       
   416  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   417  * or another error code to indicate the failure otherwise.
       
   418  */
       
   419 	{
       
   420 	TSYLOGENTRYEXIT;
       
   421 
       
   422 	TInt ret = KErrNone;
       
   423 	iAsyncHelperRequest->SetRequestId(MLtsyDispatchSmsSetMoSmsBearer::KLtsyDispatchSmsSetMoSmsBearerApiId);
       
   424 
       
   425 	return TSYLOGSETEXITERR(ret);
       
   426 	} // CLtsySmsHandler::HandleSetMoSmsBearerReqL
       
   427 
       
   428 
       
   429 TInt CLtsySmsHandler::HandleStoreSmspListEntryReqL(const RMobileSmsMessaging::TMobileSmspEntryV1& /*aSmsParam*/)
       
   430 /**
       
   431  * This request is completed by invoking
       
   432  * CCtsyDispatcherCallback::CallbackSmsStoreSmspListEntryComp
       
   433  *
       
   434  * @param aSmsParam Defines a set of SMS parameters.
       
   435  *
       
   436  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   437  * or another error code to indicate the failure otherwise.
       
   438  */
       
   439 	{
       
   440 	TSYLOGENTRYEXIT;
       
   441 
       
   442 	TInt ret = KErrNone;
       
   443 
       
   444 	// TODO: Add implementation here.......
       
   445 
       
   446 
       
   447 
       
   448 	return TSYLOGSETEXITERR(ret);
       
   449 	} // CLtsySmsHandler::HandleStoreSmspListReqL
       
   450