cbsref/telephonyrefplugins/atltsy/handler/src/cltsyphonebookenhandler.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 // CLtsyPhonebookEnHandler
       
    15 
       
    16 #include <ctsy/ltsy/cctsydispatchercallback.h>
       
    17 #include <mmtsy_ipcdefs.h>
       
    18 
       
    19 
       
    20 
       
    21 #include "cltsyphonebookenhandler.h"
       
    22 #include <ctsy/ltsy/ltsylogger.h>
       
    23 #include "ltsymacros.h"
       
    24 #include "globalphonemanager.h"
       
    25 #include "atphbkengetinfo.h"
       
    26 #include "atphbkenread.h"
       
    27 #include "atphbkenreadall.h"
       
    28 
       
    29 CLtsyPhonebookEnHandler::CLtsyPhonebookEnHandler(
       
    30 	CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    31 	:iCtsyDispatcherCallback(aCtsyDispatcherCallback),iGloblePhone(aGloblePhone)
       
    32 
       
    33 	{
       
    34 	}
       
    35 
       
    36 	
       
    37 CLtsyPhonebookEnHandler::~CLtsyPhonebookEnHandler()
       
    38 	{
       
    39 	}
       
    40 
       
    41 
       
    42 CLtsyPhonebookEnHandler* CLtsyPhonebookEnHandler::NewLC(
       
    43 		CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    44 	{
       
    45 	TSYLOGENTRYEXIT;
       
    46 	CLtsyPhonebookEnHandler* self = new (ELeave) CLtsyPhonebookEnHandler(aCtsyDispatcherCallback,aGloblePhone);
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL();
       
    49 	return self;
       
    50 	}
       
    51 
       
    52 
       
    53 CLtsyPhonebookEnHandler* CLtsyPhonebookEnHandler::NewL(CCtsyDispatcherCallback& aCtsyDispatcherCallback,CGlobalPhonemanager* aGloblePhone)
       
    54 	{
       
    55 	TSYLOGENTRYEXIT;
       
    56 	CLtsyPhonebookEnHandler* self=
       
    57 			CLtsyPhonebookEnHandler::NewLC(aCtsyDispatcherCallback,aGloblePhone);
       
    58 	CleanupStack::Pop(self);
       
    59 	return self;
       
    60 	}
       
    61 
       
    62 
       
    63 void CLtsyPhonebookEnHandler::ConstructL()
       
    64 /**
       
    65  * Second phase constructor.
       
    66  */
       
    67 	{
       
    68 	TSYLOGENTRYEXIT;
       
    69 	
       
    70 	
       
    71 	} // CLtsyPhonebookEnHandler::ConstructL
       
    72 
       
    73 TBool CLtsyPhonebookEnHandler::IsInterfaceSupported(TLtsyDispatchInterfaceApiId aDispatchApiId)
       
    74 /**
       
    75  * Returns whether a Dispatch Interface APi is supported or not.
       
    76  * 
       
    77  * @param aDispatchApiId Id of Dispatch interface being queried
       
    78  * @return indication whether interface is supported or not
       
    79  */
       
    80 	{
       
    81 
       
    82 	switch(aDispatchApiId)
       
    83 		{
       
    84 		// Insert ApiIds when support is provided in LTSY e.g.
       
    85 		// case MLtsyDispatchPhoneBootNotifySimStatusReady::KLtsyDispatchPhoneBootNotifySimStatusReadyApiId: return ETrue;
       
    86 		case  KLtsyDispatchPhonebookEnStoreGetInfoApiId:
       
    87 			return ETrue;
       
    88 		case KLtsyDispatchPhonebookEnStoreReadAllApiId:
       
    89 			return ETrue;
       
    90 		case KLtsyDispatchPhonebookEnStoreReadEntryApiId:
       
    91 			return ETrue;
       
    92 		default:
       
    93 			return EFalse;
       
    94 		}
       
    95 	}
       
    96 
       
    97 void CLtsyPhonebookEnHandler::IsCallbackIndicatorSupported(TLtsyDispatchIndIdGroup /*aIdGroup*/, TUint32& /*aIndIdBitMask*/)
       
    98 /**
       
    99  * Returns the set of callback indicators that are supported.
       
   100  * 
       
   101 * @param aIdGroup ID of group that is being queried e.g. aIdGroup=EIndIdGroup1
       
   102 * @param aIndIdBitMask [out] argument that should return a bitmask indicating which indicator callbacks are supported.
       
   103  */
       
   104 	{
       
   105 
       
   106 	//Create bitmask with bitset for each indicator ID that is supported. E.g.
       
   107 	/*
       
   108 	if(aIdGroup == EIndIdGroup1)
       
   109 		aIndIdBitMask = KLtsyDispatchPhoneNotifyNetworkModeChangeIndId | 
       
   110 						KLtsyDispatchPhoneNotifyEgprsInfoChangeIndId | 
       
   111 						KLtsyDispatchPhoneNotifySignalStrengthChangeIndId;
       
   112 	else
       
   113 		aIndIdBitMask = 0; //no indicators from other groups supported
       
   114 	*/
       
   115 	}
       
   116 
       
   117 
       
   118 TInt CLtsyPhonebookEnHandler::HandleStoreGetInfoReqL()
       
   119 /**
       
   120  * This request is completed by invoking
       
   121  * CCtsyDispatcherCallback::CallbackPhonebookEnStoreGetInfoComp()
       
   122  *
       
   123  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   124  * or another error code to indicate the failure otherwise.
       
   125  */
       
   126 	{
       
   127 	TSYLOGENTRYEXIT;
       
   128 
       
   129 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   130 	if( KErrNone == ret )
       
   131 		{
       
   132 		CAtPhbkEnGetInfo* atPhbkEnGetInfo = CAtPhbkEnGetInfo::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   133 		//Setting Port active
       
   134 		iGloblePhone->iEventSignalActive = ETrue;
       
   135 		iGloblePhone->SetActiveRequest(atPhbkEnGetInfo);
       
   136 		atPhbkEnGetInfo->StartRequest();
       
   137 		}
       
   138 
       
   139 	return TSYLOGSETEXITERR(ret);
       
   140 	} // CLtsyPhonebookEnHandler::HandleStoreGetInfoReqL
       
   141 
       
   142 
       
   143 TInt CLtsyPhonebookEnHandler::HandleStoreReadAllReqL()
       
   144 /**
       
   145  * This request is completed by invoking
       
   146  * CCtsyDispatcherCallback::CallbackPhonebookEnStoreReadAllComp()
       
   147  *
       
   148  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   149  * or another error code to indicate the failure otherwise.
       
   150  */
       
   151 	{
       
   152 	TSYLOGENTRYEXIT;
       
   153 
       
   154 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   155 	if( KErrNone == ret )
       
   156 		{
       
   157 		CAtPhbkEnReadAll* atPhbkEnReadAll = CAtPhbkEnReadAll::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   158 		//Setting Port active
       
   159 		iGloblePhone->iEventSignalActive = ETrue;
       
   160 		iGloblePhone->SetActiveRequest(atPhbkEnReadAll);
       
   161 		atPhbkEnReadAll->StartRequest();
       
   162 		}
       
   163 
       
   164 	return TSYLOGSETEXITERR(ret);
       
   165 	} // CLtsyPhonebookEnHandler::HandleStoreReadAllReqL
       
   166 
       
   167 
       
   168 TInt CLtsyPhonebookEnHandler::HandleStoreReadEntryReqL(TInt aIndex)
       
   169 /**
       
   170  * This request is completed by invoking
       
   171  * CCtsyDispatcherCallback::CallbackPhonebookEnStoreReadEntryComp()
       
   172  *
       
   173  * @param aIndex index of the EN entry.
       
   174  *
       
   175  * @return KErrNone on success, KErrNotSupported if this request is not supported,
       
   176  * or another error code to indicate the failure otherwise.
       
   177  */
       
   178 	{
       
   179 	TSYLOGENTRYEXIT;
       
   180 
       
   181 	TInt ret = iGloblePhone->CheckGlobalPhoneStatus();
       
   182 	if( KErrNone == ret )
       
   183 		{
       
   184 		CAtPhbkEnRead* atPhbkEnRead = CAtPhbkEnRead::NewL(*iGloblePhone,iCtsyDispatcherCallback);
       
   185 		//Setting Port active
       
   186 		iGloblePhone->iEventSignalActive = ETrue;
       
   187 		iGloblePhone->SetActiveRequest(atPhbkEnRead);
       
   188 		atPhbkEnRead->SetIndex(aIndex);
       
   189 		atPhbkEnRead->StartRequest();
       
   190 	    }
       
   191 
       
   192 	return TSYLOGSETEXITERR(ret);
       
   193 	} // CLtsyPhonebookEnHandler::HandleStoreReadEntryReqL
       
   194 
       
   195 
       
   196 
       
   197 
       
   198