telephonyserverplugins/multimodetsy/Multimode/sms/mSSETSC.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 // GSMSSETSC.CPP
       
    15 // Sets the default ServiceCentreAddress (SCA) stored in the ME (Mobile Equipment). AT+CSCA=xxxxxxx
       
    16 // 
       
    17 //
       
    18 
       
    19 #include "NOTIFY.H"
       
    20 #include "mSMSMESS.H"
       
    21 #include "mSSETSC.H"
       
    22 #include "mSLOGGER.H"
       
    23 #include "ATIO.H"
       
    24 
       
    25 //
       
    26 // Macros
       
    27 //
       
    28 // This macro is used to help keep un-intereting details outside of the main code
       
    29 // in this file. The macro uses logging functions and always prefixes writes to the 
       
    30 // log with the name of the class which is implemented in this file. This macro must
       
    31 // only be used by code in this file.
       
    32 #ifdef __LOGDEB__
       
    33 _LIT8(KLogEntry,"CATSmsSetSCAddress::%S\t%S");
       
    34 #define LOCAL_LOGTEXT(function,text) {_LIT8(F,function);_LIT8(T,text);LOGTEXT3(KLogEntry,&F,&T);}
       
    35 #else
       
    36 #define LOCAL_LOGTEXT(function,text)
       
    37 #endif
       
    38 
       
    39 
       
    40 
       
    41 
       
    42 CATSmsSetSCAddress* CATSmsSetSCAddress::NewL (CATIO* aIo, CTelObject* aTelObject,
       
    43 												CATInit* aInit, CPhoneGlobals* aGlobals)
       
    44 	{
       
    45 	CATSmsSetSCAddress* self = new (ELeave) CATSmsSetSCAddress(aIo, aTelObject, aInit, aGlobals);
       
    46 	CleanupStack::PushL(self);
       
    47 	self->ConstructL();
       
    48 	CleanupStack::Pop();
       
    49 	return self;
       
    50 	}
       
    51 
       
    52 CATSmsSetSCAddress::CATSmsSetSCAddress(CATIO* aIo, CTelObject* aTelObject,
       
    53 										 CATInit* aInit, CPhoneGlobals* aGlobals)
       
    54 	:CATSmsCommands(aIo, aTelObject, aInit, aGlobals)
       
    55 	{}
       
    56 
       
    57 void CATSmsSetSCAddress::Start(TTsyReqHandle aTsyReqHandle, TAny* aParam)
       
    58 	{
       
    59 	iReqHandle = aTsyReqHandle;
       
    60 
       
    61 	//
       
    62 	// Pass the SCA that we want to set to our base class
       
    63 	CATSmsCommands::iRequestSCA=*((RMobilePhone::TMobileAddress*)aParam);
       
    64 
       
    65 	//
       
    66 	// Request our base class set the SCA in the phone for us
       
    67 	TInt ret=CATSmsCommands::RequestATCommand(ESetSCAInPhone);
       
    68 	if(ret!=KErrNone)
       
    69 		Complete(ret);
       
    70 	}
       
    71 
       
    72 
       
    73 void CATSmsSetSCAddress::EventSignal(TEventSource aSource)
       
    74 	{
       
    75 	LOCAL_LOGTEXT("EventSignal","");
       
    76 
       
    77 	//
       
    78 	// Allow base class to handle events for us
       
    79 	LOCAL_LOGTEXT("EventSignal","Giving base class a chance to handle the event");
       
    80 	CATSmsCommands::EventSignal(aSource);
       
    81 
       
    82 	//
       
    83 	// Check if base class has completed our request
       
    84 	if(CATSmsCommands::RequestATCompleted()==ESetSCAInPhone)
       
    85 		{
       
    86 		LOCAL_LOGTEXT("EventSignal","Base class has completed request to set SCA");
       
    87 		LOGTEXT2(_L8("completion code: %d"),iRequestError);
       
    88 		Complete(iRequestError);
       
    89 		}
       
    90 	}
       
    91 
       
    92 
       
    93 void CATSmsSetSCAddress::Stop(TTsyReqHandle aTsyReqHandle)
       
    94 //
       
    95 //	Attempts to halt the process
       
    96 //
       
    97 	{
       
    98 	__ASSERT_ALWAYS(aTsyReqHandle == iReqHandle,Panic(EIllegalTsyReqHandle));		
       
    99 	LOCAL_LOGTEXT("Stop","Cancelling command");
       
   100 	
       
   101 	CATSmsCommands::RequestATCommandCancel();
       
   102 	}
       
   103 
       
   104 
       
   105 void CATSmsSetSCAddress::Complete(TInt aError)
       
   106 	{
       
   107 	Complete(aError,EReadCompletion);
       
   108 	}
       
   109 
       
   110 void CATSmsSetSCAddress::Complete(TInt aError,TEventSource aSource)
       
   111 	{
       
   112 	LOCAL_LOGTEXT("Complete","Enter function");
       
   113 	LOGTEXT2(_L8("Error Code : %d"), aError);
       
   114 
       
   115 	CATCommands::Complete(aError,aSource);
       
   116 	if (iReqHandle != 0)
       
   117 		iTelObject->ReqCompleted(iReqHandle, aError);
       
   118 	if (aSource==EWriteCompletion)
       
   119 		iIo->Read();
       
   120 	}
       
   121 
       
   122 void CATSmsSetSCAddress::CompleteWithIOError(TEventSource /*aSource*/,TInt aStatus)
       
   123 	{
       
   124 	iIo->WriteAndTimerCancel(this);
       
   125 	iTelObject->ReqCompleted(iReqHandle, aStatus);
       
   126 	}