1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <ecom/ecom.h>
18 const TUid KUidSmsGetDetDesc = {0x10282FA5};
20 static void CleanUpEComSmsInfoArray(TAny* aInfoArray);
23 Static factory constructor.
25 @return The constructed CSmsGetDetDescInterface object
27 inline CSmsGetDetDescInterface* CSmsGetDetDescInterface::NewL()
29 RImplInfoPtrArray implInfoArray;
30 TCleanupItem cleanup(CleanUpEComSmsInfoArray, &implInfoArray);
31 CleanupStack::PushL(cleanup);
32 // get all implementations of the SMS GetDetDesc interface
33 REComSession::ListImplementationsL(KUidSmsGetDetDesc, implInfoArray);
34 TInt count = implInfoArray.Count();
38 implInfoArray.ResetAndDestroy();
39 implInfoArray.Close();
40 CleanupStack::PopAndDestroy(&implInfoArray);
41 User::Leave(KErrNotFound);
44 CSmsGetDetDescInterface* interface = NULL;
46 for (TInt impl = 0; impl < count; ++impl)
48 if (implInfoArray[impl]->VendorId() != 0x70000001)
50 interface = REINTERPRET_CAST(
51 CSmsGetDetDescInterface*,
52 REComSession::CreateImplementationL(
53 implInfoArray[impl]->ImplementationUid(),
54 _FOFF(CSmsGetDetDescInterface, iDtor_ID_Key)));
60 interface = REINTERPRET_CAST(
61 CSmsGetDetDescInterface*,
62 REComSession::CreateImplementationL(
63 implInfoArray[0]->ImplementationUid(),
64 _FOFF(CSmsGetDetDescInterface, iDtor_ID_Key)));
67 implInfoArray.ResetAndDestroy();
68 implInfoArray.Close();
69 CleanupStack::PopAndDestroy(&implInfoArray);
76 inline CSmsGetDetDescInterface::CSmsGetDetDescInterface()
82 Destroy the ECOM implementation
84 inline CSmsGetDetDescInterface::~CSmsGetDetDescInterface()
86 REComSession::DestroyedImplementation(iDtor_ID_Key);
91 CleanUpEComSmsInfoArray function for cleanup support of locally declared arrays.
93 void CleanUpEComSmsInfoArray(TAny* aInfoArray)
95 RImplInfoPtrArray* infoArray = (static_cast<RImplInfoPtrArray*>(aInfoArray));
96 infoArray->ResetAndDestroy();