|
1 // Copyright (c) 1997-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 #include <commsdattypesv1_1.h> // CommsDat |
|
21 #include <ecom/ecom.h> |
|
22 #include <comms-infras/ss_metaconnprov.h> |
|
23 |
|
24 #ifndef SYMBIAN_SS_PROTCFGLDR_H |
|
25 #define SYMBIAN_SS_PROTCFGLDR_H |
|
26 |
|
27 namespace ESock { |
|
28 |
|
29 const TUid KCProtocolConfigLoaderUid = {0x10282300}; |
|
30 |
|
31 /* |
|
32 @internalTechnology |
|
33 */ |
|
34 class CProtocolConfigLoader : public CBase |
|
35 { |
|
36 public: |
|
37 /* |
|
38 Find protocol loader uid for protocol in commsdat load it, If not found load dummy loader |
|
39 */ |
|
40 IMPORT_C static CProtocolConfigLoader* NewL(CommsDat::CMDBSession* aDbs, const TUid aProtCfgLdrUid); |
|
41 IMPORT_C static CProtocolConfigLoader* NewL(const TUid aProtCfgLdrUid); |
|
42 |
|
43 IMPORT_C virtual ~CProtocolConfigLoader(); |
|
44 |
|
45 IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray); |
|
46 |
|
47 /* |
|
48 Load the config for protocol into provisioning object and append object as extension to |
|
49 Access Point Config. |
|
50 */ |
|
51 virtual void LoadConfigL(RMetaExtensionContainer &aApc, const TUid& aUid, const TUint aId) = 0; |
|
52 |
|
53 protected: |
|
54 inline void SetDatabaseSession(CommsDat::CMDBSession* aDbs) { iDbs = aDbs; } |
|
55 inline CommsDat::CMDBSession* DatabaseSession() const { return iDbs; } |
|
56 inline void SetProtocolUid(const TUid aUid) { iProtocolUid = aUid; } |
|
57 inline TUid ProtocolUid() const { return iProtocolUid; } |
|
58 |
|
59 private: |
|
60 TUid iDtor_ID_Key; |
|
61 CommsDat::CMDBSession* iDbs; |
|
62 TUid iProtocolUid; |
|
63 }; |
|
64 |
|
65 |
|
66 /* |
|
67 @internalTechnology |
|
68 */ |
|
69 template<typename ConfigClass> |
|
70 class CGenericProtoCfgLoader: public CProtocolConfigLoader |
|
71 { |
|
72 public: |
|
73 static CGenericProtoCfgLoader* NewL(); |
|
74 |
|
75 virtual void LoadConfigL(RMetaExtensionContainer& aApc, const TUid& aUid, const TUint aId); |
|
76 |
|
77 protected: |
|
78 CGenericProtoCfgLoader(); |
|
79 }; |
|
80 |
|
81 |
|
82 template<typename ConfigClass> |
|
83 inline CGenericProtoCfgLoader<ConfigClass>::CGenericProtoCfgLoader() |
|
84 { |
|
85 } |
|
86 |
|
87 |
|
88 template<typename ConfigClass> |
|
89 CGenericProtoCfgLoader<ConfigClass>* CGenericProtoCfgLoader<ConfigClass>::NewL() |
|
90 { |
|
91 return new(ELeave) CGenericProtoCfgLoader<ConfigClass>(); |
|
92 } |
|
93 |
|
94 |
|
95 template<typename ConfigClass> |
|
96 void CGenericProtoCfgLoader<ConfigClass>::LoadConfigL(RMetaExtensionContainer& aApc, |
|
97 const TUid& /*aUid*/, const TUint aId) |
|
98 { |
|
99 CommsDat::CMDBSession* dbs = CommsDat::CMDBSession::NewL(KCDVersion1_2); |
|
100 CleanupStack::PushL(dbs); |
|
101 |
|
102 ConfigClass* config = ConfigClass::NewL(); |
|
103 CleanupStack::PushL(config); |
|
104 |
|
105 TUint32 recordid = aId; |
|
106 config->InitialiseConfigL(*dbs, recordid); |
|
107 aApc.AppendExtensionL(config); |
|
108 |
|
109 CleanupStack::Pop(config); |
|
110 CleanupStack::PopAndDestroy(dbs); |
|
111 } |
|
112 |
|
113 } // namespace ESock |
|
114 |
|
115 |
|
116 #endif // SYMBIAN_SS_PROTCFGLDR_H |
|
117 |