cbsref/telephonyrefplugins/atltsy/atcommand/phone/src/getfdnstatus.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 // CATGetModemStatus
       
    15 // Description:
       
    16 // CGetFdnStatus
       
    17 
       
    18 #include "getfdnstatus.h"
       
    19 #include "mslogger.h"
       
    20 #include "atgetfdnsupport.h"
       
    21 #include "atgetfdnstatus.h"
       
    22 
       
    23 // Class CGetFdnStatus
       
    24 // ---------------------------------------------------------------------------
       
    25 // CGetFdnStatus::NewL
       
    26 // other items were commented in a header
       
    27 // ---------------------------------------------------------------------------
       
    28 CGetFdnStatus* CGetFdnStatus::NewL(CGlobalPhonemanager& aGloblePhone, 
       
    29 	                               CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    30 	{
       
    31 	CGetFdnStatus* self = new(ELeave) CGetFdnStatus(aGloblePhone,
       
    32 			                                        aCtsyDispatcherCallback);
       
    33 	CleanupStack::PushL(self );
       
    34 	self->ConstructL();
       
    35 	CleanupStack::Pop(self);
       
    36 	return self ;
       
    37 	}
       
    38 // ---------------------------------------------------------------------------
       
    39 // CGetFdnStatus::CGetFdnStatus
       
    40 // other items were commented in a header
       
    41 // ---------------------------------------------------------------------------
       
    42 CGetFdnStatus::CGetFdnStatus(CGlobalPhonemanager& aGloblePhone, 
       
    43 	                         CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    44 		:CATCommandControlBase(aGloblePhone,aCtsyDispatcherCallback)
       
    45 	{
       
    46 	}
       
    47 // ---------------------------------------------------------------------------
       
    48 // CGetFdnStatus::ConstructL
       
    49 // other items were commented in a header
       
    50 // ---------------------------------------------------------------------------
       
    51 void CGetFdnStatus::ConstructL()
       
    52 	{
       
    53 	iATCommandName = EATNone;
       
    54 	iATGetFdnStatus = CATGetFdnStatus::NewL(iPhoneGlobals,iCtsyDispatcherCallback);
       
    55 	iATGetFdnSupport = CATGetFdnSupport::NewL(iPhoneGlobals,iCtsyDispatcherCallback);
       
    56 	}
       
    57 // ---------------------------------------------------------------------------
       
    58 // CGetFdnStatus::~CGetFdnStatus
       
    59 // other items were commented in a header
       
    60 // ---------------------------------------------------------------------------
       
    61 CGetFdnStatus::~CGetFdnStatus()
       
    62 	{
       
    63 	delete iATGetFdnStatus;
       
    64 	iATGetFdnStatus = NULL;
       
    65 	delete iATGetFdnSupport;
       
    66 	iATGetFdnSupport = NULL;
       
    67 	}
       
    68 // ---------------------------------------------------------------------------
       
    69 // CGetFdnStatus::AtCommandExecuteComplete
       
    70 // other items were commented in a header
       
    71 // ---------------------------------------------------------------------------
       
    72 void CGetFdnStatus::AtCommandExecuteComplete(TAtEventSource aEventSource, TInt aStatus)
       
    73 	{
       
    74 	if((aEventSource == EWriteCompletion)&&(KErrNone == aStatus))
       
    75 		{
       
    76 		return;
       
    77 		}
       
    78 	switch(iATType)
       
    79 		{
       
    80 		case ELtsyAT_Phone_CheckFdnSupport:
       
    81 			if((KErrNone == aStatus)&&(aEventSource == EReadCompletion))
       
    82 				{
       
    83 				aStatus = iATGetFdnSupport->GetErrorValue();
       
    84 				}
       
    85 			iATGetFdnSupport->RemoveAtCommandObserver();
       
    86 			FdnSupportComplete(aStatus);
       
    87 			break;
       
    88 		case ELtsyAT_Phone_GetFdnStatus: 
       
    89 			if((KErrNone == aStatus)&&(aEventSource == EReadCompletion))
       
    90 				{
       
    91 				aStatus = iATGetFdnStatus->GetErrorValue();
       
    92 				}
       
    93 			FdnStatusComplete(aStatus);
       
    94 			EndATCommand(iATGetFdnStatus);
       
    95 			delete iATGetFdnStatus;
       
    96 			iATGetFdnStatus = NULL;
       
    97 			iPhoneGlobals.iEventSignalActive = EFalse;
       
    98 			break;
       
    99 		default:
       
   100 			break;
       
   101 		}
       
   102 	}
       
   103 // ---------------------------------------------------------------------------
       
   104 // CGetFdnStatus::StartRequestL
       
   105 // other items were commented in a header
       
   106 // ---------------------------------------------------------------------------
       
   107 void CGetFdnStatus::StartRequest()
       
   108 	{
       
   109 	StartATCommand(iATGetFdnSupport);
       
   110 	}
       
   111 // ---------------------------------------------------------------------------
       
   112 // CGetFdnStatus::HandleFdnSupport
       
   113 // other items were commented in a header
       
   114 // ---------------------------------------------------------------------------
       
   115 void CGetFdnStatus::FdnSupportComplete(const TInt aError)
       
   116 	{
       
   117 	if((KErrNone == aError)&&(iATGetFdnSupport->GetFdnSupport()))
       
   118 		{	
       
   119 		EndATCommand(iATGetFdnSupport);
       
   120 		StartATCommand(iATGetFdnStatus);
       
   121 		}
       
   122 	else
       
   123 		{
       
   124 		EndATCommand(iATGetFdnSupport);
       
   125 		iPhoneGlobals.iEventSignalActive = EFalse;
       
   126 		iCtsyDispatcherCallback.CallbackPhoneGetFdnStatusComp(aError,RMobilePhone::EFdnUnknown);
       
   127 		}
       
   128 	}
       
   129 // ---------------------------------------------------------------------------
       
   130 // CGetFdnStatus::FdnStatusComplete
       
   131 // other items were commented in a header
       
   132 // ---------------------------------------------------------------------------
       
   133 void CGetFdnStatus::FdnStatusComplete(const TInt aError)
       
   134 	{
       
   135 	if((KErrNone == aError)&&(iATGetFdnStatus->GetFdnStatus()))
       
   136 		{
       
   137 		iCtsyDispatcherCallback.CallbackPhoneGetFdnStatusComp(aError,RMobilePhone::EFdnActive);
       
   138 		}
       
   139 	else
       
   140 		{
       
   141 		iCtsyDispatcherCallback.CallbackPhoneGetFdnStatusComp(aError,RMobilePhone::EFdnNotActive);
       
   142 		}
       
   143 	}
       
   144 
       
   145 // ---------------------------------------------------------------------------
       
   146 // CGetFdnStatus::StartATCommand
       
   147 // other items were commented in a header
       
   148 // ---------------------------------------------------------------------------
       
   149 void CGetFdnStatus::StartATCommand(CAtCommandBase* aAtCommand)
       
   150 	{
       
   151 	aAtCommand->SetAtCommandObserver(this);
       
   152 	iATType = aAtCommand->AtType();
       
   153 	aAtCommand->StartRequest();
       
   154 	}
       
   155 // ---------------------------------------------------------------------------
       
   156 // CGetFdnStatus::EndATCommand
       
   157 // other items were commented in a header
       
   158 // ---------------------------------------------------------------------------
       
   159 void CGetFdnStatus::EndATCommand(CAtCommandBase* aAtCommand)
       
   160 	{
       
   161 	aAtCommand->RemoveAtCommandObserver();
       
   162 	aAtCommand->Complete();
       
   163 	}
       
   164 //
       
   165 // End of file