cbsref/telephonyrefplugins/atltsy/atcommand/phone/src/atgetcellinfo.cpp
changeset 49 f50f4094acd7
equal deleted inserted replaced
48:14460bf2a402 49:f50f4094acd7
       
     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 // CATGetCellInfo
       
    15 
       
    16 //user include
       
    17 #include "atgetcellinfo.h"
       
    18 #include "mslogger.h"
       
    19 
       
    20 _LIT8(KGetCellInfoCommand,"AT+CCED=0,7\r");
       
    21 _LIT8(KGetCellInfoCmdRepondStr,"+CCED:");
       
    22 // Class CATGetCellInfo
       
    23 // ---------------------------------------------------------------------------
       
    24 // CATGetCellInfo::NewL
       
    25 // other items were commented in a header
       
    26 // ---------------------------------------------------------------------------
       
    27 CATGetCellInfo* CATGetCellInfo::NewL(CGlobalPhonemanager& aGloblePhone, 
       
    28 	                                 CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    29 	{
       
    30 	CATGetCellInfo* self = new(ELeave) CATGetCellInfo(aGloblePhone,
       
    31 			                                          aCtsyDispatcherCallback);
       
    32 	CleanupStack::PushL(self );
       
    33 	self->ConstructL();
       
    34 	CleanupStack::Pop(self );
       
    35 	return self ;
       
    36 	}
       
    37 // ---------------------------------------------------------------------------
       
    38 // CATGetCellInfo::CATGetCellInfo
       
    39 // other items were commented in a header
       
    40 // ---------------------------------------------------------------------------
       
    41 CATGetCellInfo::CATGetCellInfo(CGlobalPhonemanager& aGloblePhone, 
       
    42 	                           CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    43 		:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
       
    44 	{
       
    45 	}
       
    46 // ---------------------------------------------------------------------------
       
    47 // CATGetCellInfo::ConstructL
       
    48 // other items were commented in a header
       
    49 // ---------------------------------------------------------------------------
       
    50 void CATGetCellInfo::ConstructL()
       
    51 	{
       
    52 	CAtCommandBase::ConstructL();
       
    53 	}
       
    54 // ---------------------------------------------------------------------------
       
    55 // CATGetCellInfo::~CATGetCellInfo(
       
    56 // other items were commented in a header
       
    57 // ---------------------------------------------------------------------------
       
    58 CATGetCellInfo::~CATGetCellInfo()
       
    59 	{
       
    60 	}
       
    61 // ---------------------------------------------------------------------------
       
    62 // CATGetCellInfo::StartRequestL
       
    63 // other items were commented in a header
       
    64 // ---------------------------------------------------------------------------
       
    65 void CATGetCellInfo::StartRequest()
       
    66 	{
       
    67 	ExecuteCommand();
       
    68 	}
       
    69 // ---------------------------------------------------------------------------
       
    70 // CATGetCellInfo::ExecuteCommand
       
    71 // other items were commented in a header
       
    72 // ---------------------------------------------------------------------------
       
    73 void CATGetCellInfo::ExecuteCommand()
       
    74 	{
       
    75 	iTxBuffer.Copy(KGetCellInfoCommand);
       
    76 	Write();
       
    77 	}
       
    78 // ---------------------------------------------------------------------------
       
    79 // CATGetCellInfo::ParseResponseL
       
    80 // other items were commented in a header
       
    81 // ---------------------------------------------------------------------------
       
    82 void CATGetCellInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
       
    83 	{
       
    84 	if (CurrentLine().Match(KLtsyOkString) != 0)
       
    85 		{
       
    86 		iError = KErrGeneral;
       
    87 		return ;
       
    88 		}
       
    89 	RArray<TPtrC8> array;
       
    90 	CleanupClosePushL(array);
       
    91 	iParser->ParseRespondedBuffer(array,PrecedingLine());
       
    92 	TInt Count = array.Count();
       
    93 	if (Count < 1)
       
    94 		{
       
    95 		CleanupStack::PopAndDestroy();
       
    96 		iError = KErrNotFound;
       
    97 		return;
       
    98 		}
       
    99 	if( array[0].MatchF(KGetCellInfoCmdRepondStr)==KErrNotFound)
       
   100 		{
       
   101 		CleanupStack::PopAndDestroy();
       
   102 		iError = KErrNotFound;
       
   103 		return ;
       
   104 		}
       
   105 	TInt number = 0;
       
   106 	TInt val = 0;
       
   107 	TLex8 lexBasic(array[5]);
       
   108 	lexBasic.Val(val);
       
   109 	iCellInfo.iNmr[number].iBSIC = val;
       
   110 	TLex8 lexArfcn(array[6]);
       
   111 	lexArfcn.Val(val);
       
   112 	iCellInfo.iNmr[number].iARFCN = val;
       
   113 	TLex8 lexRxlev(array[7]);
       
   114 	lexRxlev.Val(val);
       
   115 	iCellInfo.iNmr[number].iRxLEV = val;
       
   116 	
       
   117 	
       
   118     for(TInt i = 14;i < Count-2;i++ )
       
   119     	{
       
   120     	number++;
       
   121     	i = i + 4;
       
   122     	TInt val = 0;
       
   123     	TLex8 lexBasic(array[i]);
       
   124     	lexBasic.Val(val);
       
   125     	i++;
       
   126     	iCellInfo.iNmr[number].iBSIC = val;
       
   127     	TLex8 lexArfcn(array[i]);
       
   128     	lexArfcn.Val(val);
       
   129     	iCellInfo.iNmr[number].iARFCN = val;
       
   130     	i++;
       
   131     	TLex8 lexRxlev(array[i]);
       
   132     	lexRxlev.Val(val);
       
   133     	iCellInfo.iNmr[number].iRxLEV = val;
       
   134     	}
       
   135 	TLex8 lexTa(array[Count-2]);
       
   136 	lexTa.Val(val);
       
   137     iCellInfo.iTA = val;
       
   138 	
       
   139 	
       
   140 	CleanupStack::PopAndDestroy(&array);
       
   141 	iError = KErrNone;
       
   142 	}
       
   143 // ---------------------------------------------------------------------------
       
   144 // CATGetCellInfo::EventSignal
       
   145 // other items were commented in a header
       
   146 // ---------------------------------------------------------------------------
       
   147 void CATGetCellInfo::EventSignal(TAtEventSource aEventSource, TInt aStatus)
       
   148 	{
       
   149 	if(KErrNone ==aStatus)
       
   150 		{
       
   151 		if(aEventSource == EReadCompletion)
       
   152 			{
       
   153 			aStatus = iError;
       
   154 			}
       
   155 		else if(aEventSource == EWriteCompletion)
       
   156 		    {
       
   157 		    return;
       
   158 		    }
       
   159 		}
       
   160 	
       
   161 	// complete this request
       
   162 	CAtCommandBase::Complete();
       
   163 	iPhoneGlobals.iEventSignalActive = EFalse;
       
   164 	iCtsyDispatcherCallback.CallbackPhoneGetCellInfoComp(aStatus,iCellInfo);
       
   165 	if(iIpcCompleteObserver)
       
   166 	    {
       
   167 	    iIpcCompleteObserver->NotifyIpcRequestComplete(iIpcId);
       
   168 	    }
       
   169 	}
       
   170 //
       
   171 // End of file