|
1 // Copyright (c) 2005-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 // Implementation file for the the Reference SubConnection Provider Factory |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 |
|
24 #include "ReferenceSCPR_subconnProvFactory.h" |
|
25 #include "ReferenceSCPR_defaultSubconnProv.h" |
|
26 #include "ReferenceSCPR_subconnProv.h" |
|
27 #include "ReferenceSCPR_subconparams.h" |
|
28 #include <implementationproxy.h> |
|
29 |
|
30 //The following represents the Factory ID for the Reference subconnection |
|
31 //provider. See the assisting *.rss file in the ../src directory. |
|
32 const TUint KReferenceSubConnectionProviderImplementationUid = 0x102738C3; |
|
33 |
|
34 //-========================================================= |
|
35 // Data/functions required for instantiating ECOM Plugin |
|
36 //-========================================================= |
|
37 const TImplementationProxy ImplementationTable[] = |
|
38 { |
|
39 IMPLEMENTATION_PROXY_ENTRY(KReferenceSubConnectionProviderImplementationUid, CReferenceSubConnectionProviderFactory::NewL), |
|
40 IMPLEMENTATION_PROXY_ENTRY(KSubConReferenceParamsUid, CReferenceSubConnExtensionParamsFactory::NewL) |
|
41 }; |
|
42 |
|
43 |
|
44 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
45 { |
|
46 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
47 |
|
48 return ImplementationTable; |
|
49 } |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 //-========================================================= |
|
56 // CReferenceSubConnectionProviderFactory |
|
57 //-========================================================= |
|
58 |
|
59 CReferenceSubConnectionProviderFactory* CReferenceSubConnectionProviderFactory::NewL(TAny* aConstructionParameters) |
|
60 /**NewL is the actual ECOM SubConnection Provider interface implemented. |
|
61 ESOCK with call it to instantiate the factory and store it the |
|
62 CSubConnectionProviderFacoryContainer. |
|
63 |
|
64 @param aConstructionParameters construction data passed by ECOM |
|
65 @returns pointer to a constructed factory |
|
66 */ |
|
67 { |
|
68 CReferenceSubConnectionProviderFactory* ptr = |
|
69 new (ELeave) CReferenceSubConnectionProviderFactory(KReferenceSubConnectionProviderFactoryId, |
|
70 *(reinterpret_cast<CSubConnectionFactoryContainer*>(aConstructionParameters))); |
|
71 return ptr; |
|
72 } |
|
73 |
|
74 |
|
75 |
|
76 CReferenceSubConnectionProviderFactory::CReferenceSubConnectionProviderFactory(TUint aFactoryId, |
|
77 CSubConnectionFactoryContainer& aParentContainer) |
|
78 :CSubConnectionProviderFactoryBase(aFactoryId, aParentContainer) |
|
79 /**C'tor |
|
80 @param aFactoryId - the id of this factory. The id should represent the type of subconnection |
|
81 providers this factory can produce. |
|
82 @param aParentContainer - the factory container the new factory object should add itself to. |
|
83 */ |
|
84 { |
|
85 } |
|
86 |
|
87 |
|
88 |
|
89 /**D'tor |
|
90 |
|
91 */ |
|
92 CReferenceSubConnectionProviderFactory::~CReferenceSubConnectionProviderFactory() |
|
93 { |
|
94 } |
|
95 |
|
96 |
|
97 /**A sample/reference derivation of DoCreateProviderL. The method must be overriden to create |
|
98 (instantiate) the actual CSubConnectionProviderBase objects. |
|
99 |
|
100 @param aConnProvider - the connection, the subconnection provider object should belong to. |
|
101 @param aType - the type of the subconnection provider object within the meaning defined by |
|
102 RSubConnection::TSubConnType: |
|
103 * ECreateNew - the subconnection provider object shall represent a new, reserved, |
|
104 private flow. |
|
105 * EAttachToDefault - the subconnection provider object shall represent the |
|
106 default channel - a singular channel that each connection always has. |
|
107 */ |
|
108 CSubConnectionProviderBase* CReferenceSubConnectionProviderFactory::DoCreateProviderL( |
|
109 CConnectionProviderBase& aConnProvider, |
|
110 RSubConnection::TSubConnType aType) |
|
111 { |
|
112 CSubConnectionProviderBase* provider = NULL; |
|
113 if (aType == RSubConnection::EAttachToDefault) |
|
114 { |
|
115 provider = CReferenceDefaultSubConnectionProvider::NewL(*this, aConnProvider); |
|
116 } |
|
117 else if (aType == RSubConnection::ECreateNew) |
|
118 { |
|
119 provider = CReferenceSubConnectionProvider::NewL(*this, aConnProvider); |
|
120 } |
|
121 else |
|
122 { |
|
123 User::Leave(KErrNotSupported); |
|
124 } |
|
125 return provider; |
|
126 } |