cbsref/telephonyrefplugins/atltsy/atcommand/phone/src/atgetfdnsupport.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
child 21 4814c5a49428
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     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 // CATGetFdnSupport
       
    15 
       
    16 //user include
       
    17 #include "atgetfdnsupport.h"
       
    18 #include "mslogger.h"
       
    19 
       
    20 
       
    21 _LIT8(KGetFdnSupportCommand,"AT+CPBS=?\r");
       
    22 _LIT8(KGetFdnSupportCmdRepondStr,"+CPBS:");
       
    23 _LIT8(KFdnString,"FD");
       
    24 // Class CATGetFdnSupport
       
    25 // ---------------------------------------------------------------------------
       
    26 // CATGetFdnSupport::NewL
       
    27 // other items were commented in a header
       
    28 // ---------------------------------------------------------------------------
       
    29 CATGetFdnSupport* CATGetFdnSupport::NewL(CGlobalPhonemanager& aGloblePhone, 
       
    30 	                               CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    31 	{
       
    32 	CATGetFdnSupport* self = new(ELeave) CATGetFdnSupport(aGloblePhone,
       
    33 			                                        aCtsyDispatcherCallback);
       
    34 	CleanupStack::PushL(self );
       
    35 	self->ConstructL();
       
    36 	CleanupStack::Pop(self );
       
    37 	return self ;
       
    38 	}
       
    39 // ---------------------------------------------------------------------------
       
    40 // CATGetFdnSupport::CATGetFdnSupport
       
    41 // other items were commented in a header
       
    42 // ---------------------------------------------------------------------------
       
    43 CATGetFdnSupport::CATGetFdnSupport(CGlobalPhonemanager& aGloblePhone, 
       
    44 	                         CCtsyDispatcherCallback& aCtsyDispatcherCallback)
       
    45 		:CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback)
       
    46 	{
       
    47 	}
       
    48 // ---------------------------------------------------------------------------
       
    49 // CATGetFdnSupport::ConstructL
       
    50 // other items were commented in a header
       
    51 // ---------------------------------------------------------------------------
       
    52 void CATGetFdnSupport::ConstructL()
       
    53 	{
       
    54 	CAtCommandBase::ConstructL();
       
    55 	iFdnSupport = EFalse;
       
    56 	iAtType = ELtsyAT_Phone_CheckFdnSupport; 
       
    57 	}
       
    58 // ---------------------------------------------------------------------------
       
    59 // CATGetFdnSupport::~CATGetFdnSupport
       
    60 // other items were commented in a header
       
    61 // ---------------------------------------------------------------------------
       
    62 CATGetFdnSupport::~CATGetFdnSupport()
       
    63 	{
       
    64 	}
       
    65 // ---------------------------------------------------------------------------
       
    66 // CATGetFdnSupport::StartRequestL
       
    67 // other items were commented in a header
       
    68 // ---------------------------------------------------------------------------
       
    69 void CATGetFdnSupport::StartRequest()
       
    70 	{
       
    71 	ExecuteCommand();
       
    72 	}
       
    73 // ---------------------------------------------------------------------------
       
    74 // CATGetFdnSupport::ExecuteCommand
       
    75 // other items were commented in a header
       
    76 // ---------------------------------------------------------------------------
       
    77 void CATGetFdnSupport::ExecuteCommand()
       
    78 	{
       
    79 	iTxBuffer.Copy(KGetFdnSupportCommand);
       
    80 	Write();
       
    81 	}
       
    82 // ---------------------------------------------------------------------------
       
    83 // CATGetFdnSupport::CATGetFdnSupport
       
    84 // other items were commented in a header
       
    85 // ---------------------------------------------------------------------------
       
    86 TBool CATGetFdnSupport::GetFdnSupport()
       
    87 	{
       
    88 	return iFdnSupport;
       
    89 	}
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CATGetFdnSupport::GetErrorValue
       
    93 // other items were commented in a header
       
    94 // ---------------------------------------------------------------------------
       
    95 TInt CATGetFdnSupport::GetErrorValue()
       
    96 	{
       
    97 	return iError;
       
    98 	}
       
    99 // ---------------------------------------------------------------------------
       
   100 // CATGetFdnSupport::ParseResponseL
       
   101 // This method parses the modems response to the 'AT+CPBS=?' command.
       
   102 // +CPBS: <pb>
       
   103 // <pb> values reserved by this TS:
       
   104 // "SM" SIM phonebook
       
   105 // "FD" SIM fixdialling-phonebook
       
   106 // "ON" SIM (or ME) own numbers (MSISDNs) list (reading of this storage may be 
       
   107 // available through +CNUM also) 
       
   108 // "EN" SIM (or ME) emergency number (+CPBW is not be applicable for this storage) 
       
   109 // "LD" SIM last-dialling-phonebook
       
   110 // "MC" ME missed (unanswered received) calls list (+CPBW may not be applicable for 
       
   111 // this storage)
       
   112 // "ME" ME phonebook
       
   113 // "MT" combined ME and SIM phonebook
       
   114 // "RC" ME received calls list (+CPBW may not be applicable for this storage)
       
   115 // "SN" SDN  (service dailing phonebook)
       
   116 // An example response is '+CPBS: "SM","FD","ON","EN" 
       
   117 // other items were commented in a header
       
   118 // ---------------------------------------------------------------------------
       
   119 void CATGetFdnSupport::ParseResponseL(const TDesC8& /*aResponseBuf*/)
       
   120 	{
       
   121 	if (CurrentLine().Match(KLtsyOkString) != 0)
       
   122 		{
       
   123 		iError = KErrGeneral;
       
   124 		return ;
       
   125 		}
       
   126 	RArray<TPtrC8> array;
       
   127 	CleanupClosePushL(array);
       
   128 	iParser->ParseRespondedBuffer(array,PrecedingLine());
       
   129 	TInt Count = array.Count();
       
   130 	if (Count < 1)
       
   131 		{
       
   132 		CleanupStack::PopAndDestroy();
       
   133 		iError = KErrNotFound;
       
   134 		return;
       
   135 		}
       
   136 	if( array[0].MatchF(KGetFdnSupportCmdRepondStr)==KErrNotFound)
       
   137 		{
       
   138 		CleanupStack::PopAndDestroy();
       
   139 		iError = KErrNotFound;
       
   140 		return ;
       
   141 		}
       
   142 	for(TInt i = 1; i < Count; i++)
       
   143 		{
       
   144 		if( array[i].MatchF(KFdnString)!=KErrNotFound)
       
   145 			{
       
   146 			iFdnSupport = ETrue;
       
   147 			break;
       
   148 			}
       
   149 		}
       
   150 	
       
   151 	CleanupStack::PopAndDestroy(&array);
       
   152 	iError = KErrNone;
       
   153 	}
       
   154 //
       
   155 // End of file