diff -r 0efa10d348c0 -r a5a39a295112 idlefw/src/idleint/aiidleappregister.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/idlefw/src/idleint/aiidleappregister.cpp Wed Sep 01 12:22:09 2010 +0100 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Active Idle <-> Phone app synchronizer implementation. +* +*/ + + +#include "aiidleappregisterimpl.h" +#include +#include +#include + +namespace + { + _LIT_SECURITY_POLICY_C1( KTelephonyInformationReadPolicy, ECapabilityReadDeviceData ); + _LIT_SECURITY_POLICY_C1( KTelephonyInformationWritePolicy, ECapabilityWriteDeviceData ); + _LIT_SECURITY_POLICY_PASS( KTelephonyInformationPolicyAlwaysPass ); + + const TInt KActOnSendKey = 1; + + TInt SetIdleAppPS() + { + return RProperty::Set( + KPSUidAiInformation, + KActiveIdleUid, + AI_UID3_AIFW_EXE ); + } + + TInt DefineIdleAppPS() + { + return RProperty::Define( + KPSUidAiInformation, + KActiveIdleUid, + RProperty::EInt, + KTelephonyInformationReadPolicy, + KTelephonyInformationWritePolicy ); + } + + TInt DefineIdleStatePS() + { + RProperty::Define( + KPSUidAiInformation, + KActiveIdlePopupState, + RProperty::EInt, + KTelephonyInformationPolicyAlwaysPass, + KTelephonyInformationWritePolicy ); + return RProperty::Define( + KPSUidAiInformation, + KActiveIdleState, + RProperty::EInt, + KTelephonyInformationPolicyAlwaysPass, + KTelephonyInformationWritePolicy ); + } + + TInt DefineIdleSendKeyPS() + { + return RProperty::Define( + KPSUidAiInformation, + KActiveIdleActOnSendKey, + RProperty::EInt, + KTelephonyInformationReadPolicy, + KTelephonyInformationWritePolicy ); + } + TInt SetIdleSendKeyPS() + { + return RProperty::Set( + KPSUidAiInformation, + KActiveIdleActOnSendKey, + KActOnSendKey ); + } + + TInt DefineIdleSimRegFailedReceivedPS() + { + return RProperty::Define( + KPSUidAiInformation, + KActiveIdleSimRegFailedReceived, + RProperty::EInt, + KTelephonyInformationReadPolicy, + KTelephonyInformationWritePolicy ); + } + + TInt DefineIdleSendNumKeysToPhonePS() + { + return RProperty::Define( + KPSUidAiInformation, + KActiveIdleForwardNumericKeysToPhone, + RProperty::EInt, + ECapabilityReadDeviceData, + ECapabilityWriteDeviceData ); + + } + + TInt SetIdleSendNumKeysToPhonePS() + { + return RProperty::Set(KPSUidAiInformation, + KActiveIdleForwardNumericKeysToPhone, + EPSAiForwardNumericKeysToPhone); + } + } + +CAiIdleAppRegisterImpl* CAiIdleAppRegisterImpl::NewLC() + { + CAiIdleAppRegisterImpl* self = new(ELeave) CAiIdleAppRegisterImpl; + CleanupStack::PushL( self ); + return self; + } + +CAiIdleAppRegisterImpl::~CAiIdleAppRegisterImpl() + { + } + +void CAiIdleAppRegisterImpl::RegisterL() + { + // Give own uid for phone. + TInt setPSResult = SetIdleAppPS(); + if ( setPSResult == KErrNotFound ) + { + // Key not defined yet -> try to define + const TInt err = DefineIdleAppPS(); + if( err == KErrNone || err == KErrAlreadyExists ) + { + // Try setting again + setPSResult = SetIdleAppPS(); + } + } + + DefineIdleSendKeyPS(); + + DefineIdleSimRegFailedReceivedPS(); + + // Set the default value to 1 so the send key press is reacted + SetIdleSendKeyPS(); + + // Failure to set the telephony P&S key is fatal + User::LeaveIfError( setPSResult ); + + // Define idle state key + DefineIdleStatePS(); + + DefineIdleSendNumKeysToPhonePS(); + + SetIdleSendNumKeysToPhonePS(); + } + +CAiIdleAppRegisterImpl::CAiIdleAppRegisterImpl() + { + } + +EXPORT_C CAiIdleAppRegister* CAiIdleAppRegister::NewLC() + { + return CAiIdleAppRegisterImpl::NewLC(); + } +