1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/cimmobilitypolicyplugin.inl Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,101 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <ecom/ecom.h>
1.20 +
1.21 +const TUid KUidImMobilityPolicy = {0x10283066};
1.22 +
1.23 +/**
1.24 +CleanUpEComSmsInfoArray function for cleanup support of locally declared arrays.
1.25 +*/
1.26 +void CleanUpEComInfoArray(TAny* aInfoArray)
1.27 + {
1.28 + RImplInfoPtrArray* infoArray = (static_cast<RImplInfoPtrArray*>(aInfoArray));
1.29 + infoArray->ResetAndDestroy();
1.30 + infoArray->Close();
1.31 + }
1.32 +
1.33 +/**
1.34 +Static factory constructor.
1.35 +
1.36 +@return The constructed CImMobilityPolicyPlugin object
1.37 +*/
1.38 +inline CImMobilityPolicyPlugin* CImMobilityPolicyPlugin::NewL()
1.39 + {
1.40 + RImplInfoPtrArray implInfoArray;
1.41 + TCleanupItem cleanup(CleanUpEComInfoArray, &implInfoArray);
1.42 + CleanupStack::PushL(cleanup);
1.43 +
1.44 + // get all implementations of the mobility policy plugin interface
1.45 + REComSession::ListImplementationsL(KUidImMobilityPolicy, implInfoArray);
1.46 + TInt count = implInfoArray.Count();
1.47 +
1.48 + if (count == 0)
1.49 + {
1.50 + implInfoArray.ResetAndDestroy();
1.51 + implInfoArray.Close();
1.52 + CleanupStack::PopAndDestroy(&implInfoArray);
1.53 + User::Leave(KErrNotFound);
1.54 + }
1.55 +
1.56 + CImMobilityPolicyPlugin* interface = NULL;
1.57 +
1.58 + for (TInt impl = 0; impl < count; ++impl)
1.59 + {
1.60 + if (implInfoArray[impl]->VendorId() != 0x70000001)
1.61 + {
1.62 + interface = REINTERPRET_CAST(
1.63 + CImMobilityPolicyPlugin*,
1.64 + REComSession::CreateImplementationL(
1.65 + implInfoArray[impl]->ImplementationUid(),
1.66 + _FOFF(CImMobilityPolicyPlugin, iDtor_ID_Key)));
1.67 + }
1.68 + }
1.69 +
1.70 + if (!interface)
1.71 + {
1.72 + interface = REINTERPRET_CAST(
1.73 + CImMobilityPolicyPlugin*,
1.74 + REComSession::CreateImplementationL(
1.75 + implInfoArray[0]->ImplementationUid(),
1.76 + _FOFF(CImMobilityPolicyPlugin, iDtor_ID_Key)));
1.77 + }
1.78 +
1.79 + implInfoArray.ResetAndDestroy();
1.80 + implInfoArray.Close();
1.81 + CleanupStack::PopAndDestroy(&implInfoArray);
1.82 + return interface;
1.83 + }
1.84 +
1.85 +/**
1.86 +Class constructor.
1.87 +*/
1.88 +inline CImMobilityPolicyPlugin::CImMobilityPolicyPlugin()
1.89 + {
1.90 + }
1.91 +
1.92 +/**
1.93 +Class destructor.
1.94 +Destroy the ECOM implementation
1.95 +*/
1.96 +inline CImMobilityPolicyPlugin::~CImMobilityPolicyPlugin()
1.97 + {
1.98 + REComSession::DestroyedImplementation(iDtor_ID_Key);
1.99 + }
1.100 +
1.101 +
1.102 +
1.103 +
1.104 +