|
1 // Copyright (c) 2010 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 // MbufGobbler selector. Used by the Tier Manager to select the access point below |
|
15 // (management plane) |
|
16 // |
|
17 // |
|
18 // This is a 3-plane comms layer implementation example, which has been customised to be a test layer which gobbles and releases ESOCK MBUFs. |
|
19 // The MBuf gobbling functionality can be disabled by undefining the macro SYMBIAN_COMMSFW_MBUF_GOBBLER which is specified in mbufgobblerproviders.mmp. |
|
20 // When SYMBIAN_COMMSFW_MBUF_GOBBLER is undefined, the source code specified by mbufgobblerproviders.mmp becomes a pass through layer i.e. it passes the data |
|
21 // through to the layer above or below without altering it. This makes it useful as a starting point for implementing your own layers / providers; |
|
22 // useful documentation on how to customise your own passthrough layer can be found in ..\docs\MbufGobblerLayer.doc |
|
23 // |
|
24 |
|
25 /** |
|
26 @file |
|
27 @internalComponent |
|
28 */ |
|
29 |
|
30 #include "mbufgobblerproviderselector.h" |
|
31 #include "mbufgobblerlog.h" |
|
32 |
|
33 //extra includes |
|
34 #include <ss_select.h> //needed as declares MProviderSelector. |
|
35 #include <metadatabase.h> //needed for CommsDat::CMDBSession |
|
36 #include <ss_tiermanagerutils.h> //needed for ESock::TierManagerUtils |
|
37 #include <commsdattypesv1_1_partner.h> //needed for CCDTierRecord (iTierRecord) |
|
38 |
|
39 #include "mbufgobbler_panic.h" //needed for ASSERT_DEBUG |
|
40 #include "mbufgobblertiermanagerfactory.h" //needed for CMbufGobblerTierManagerFactory::iUid |
|
41 #include "mbufgobblermetaconnproviderfactory.h" //needed for CMbufGobblerMetaConnectionProviderFactory::iUid |
|
42 |
|
43 |
|
44 ESock::MProviderSelector* CMbufGobblerProviderSelector::NewL(const Meta::SMetaData& aSelectionPreferences) |
|
45 { |
|
46 //LOG_STATIC_FUNC |
|
47 ASSERT_DEBUG(aSelectionPreferences.IsTypeOf(ESock::TSelectionPrefs::TypeId()), EUnexpectedTSelectionPrefsType); |
|
48 |
|
49 CMbufGobblerProviderSelector* self = NULL; |
|
50 self = new(ELeave) CMbufGobblerProviderSelector(aSelectionPreferences); |
|
51 CleanupStack::PushL(self); |
|
52 |
|
53 CommsDat::CMDBSession* dbs = CommsDat::CMDBSession::NewLC(KCDVersion1_2); |
|
54 |
|
55 self->iTierRecord = ESock::TierManagerUtils::LoadTierRecordL(TUid::Uid(CMbufGobblerTierManagerFactory::iUid), *dbs); |
|
56 |
|
57 ASSERT_DEBUG(static_cast<TUint32>(self->iTierRecord->iDefaultAccessPoint)!=0,EUnexpectedTSelectionPrefsType); |
|
58 |
|
59 CleanupStack::Pop(dbs); |
|
60 CleanupStack::Pop(self); |
|
61 ASSERT_DEBUG(self->iDbs == NULL, EInvalidNullPtr); |
|
62 self->iDbs = dbs; |
|
63 return self; |
|
64 } |
|
65 |
|
66 CMbufGobblerProviderSelector::CMbufGobblerProviderSelector(const Meta::SMetaData& aSelectionPreferences) |
|
67 : ASimpleSelectorBase(aSelectionPreferences) |
|
68 { |
|
69 } |
|
70 |
|
71 CMbufGobblerProviderSelector::~CMbufGobblerProviderSelector() |
|
72 { |
|
73 } |
|
74 |
|
75 void CMbufGobblerProviderSelector::Destroy() |
|
76 { |
|
77 delete this; |
|
78 } |
|
79 |
|
80 |
|
81 /** |
|
82 Find or create a Mbufgobbler Meta Connection Provider |
|
83 */ |
|
84 ESock::CMetaConnectionProviderBase* CMbufGobblerProviderSelector::FindOrCreateProviderL(TUint aAccessPoint) |
|
85 { |
|
86 return ASimpleSelectorBase::FindOrCreateProviderL(aAccessPoint); |
|
87 } |
|
88 |
|
89 |
|
90 /** |
|
91 Perform the selection of a Meta Connection Provider |
|
92 */ |
|
93 void CMbufGobblerProviderSelector::SelectL(ESock::ISelectionNotify& aSelectionNotify) |
|
94 { |
|
95 ASSERT_DEBUG(iDbs, EInvalidNullPtr); |
|
96 ASSERT_DEBUG(iTierRecord, EInvalidNullPtr); |
|
97 TUint32 defaultAccessPoint = iTierRecord->iDefaultAccessPoint; |
|
98 |
|
99 //Must be set |
|
100 User::LeaveIfError(defaultAccessPoint!=0 ? KErrNone : KErrCorrupt); |
|
101 |
|
102 // Send select complete with the provider, and the final select complete |
|
103 aSelectionNotify.SelectComplete(this, FindOrCreateProviderL(defaultAccessPoint)); |
|
104 aSelectionNotify.SelectComplete(this, NULL); |
|
105 } |