|
1 // Copyright (c) 2008-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 #include "susadaptationpluginloader.h" |
|
17 #include "suspanic.h" |
|
18 |
|
19 CSusAdaptationPluginLoader* CSusAdaptationPluginLoader::NewL() |
|
20 { |
|
21 CSusAdaptationPluginLoader* self = new (ELeave) CSusAdaptationPluginLoader(); |
|
22 return self; |
|
23 } |
|
24 |
|
25 CSusAdaptationPluginLoader::CSusAdaptationPluginLoader() |
|
26 { |
|
27 |
|
28 } |
|
29 |
|
30 CSusAdaptationPluginLoader::~CSusAdaptationPluginLoader() |
|
31 { |
|
32 ilibEmergencyCallRfAdaptation.Close(); |
|
33 ilibStateAdaptation.Close(); |
|
34 ilibSimAdaptation.Close(); |
|
35 ilibMiscAdaptation.Close(); |
|
36 ilibRtcAdaptation.Close(); |
|
37 } |
|
38 |
|
39 MStateAdaptation* CSusAdaptationPluginLoader::CreateStateAdaptationL() |
|
40 { |
|
41 __ASSERT_DEBUG( KNullHandle == ilibStateAdaptation.Handle(), User::Panic(KPanicSsmSus, ELibraryAlreadyOpen)); |
|
42 MStateAdaptation* stateAdaptationPlugin = NULL; |
|
43 TInt err = ilibStateAdaptation.Load(KStateAdaptationPlugin); |
|
44 |
|
45 // if licensees have not provided the State Adaptation Plugin, we try to load the reference |
|
46 // State Adaptation Plugin provided by Symbian |
|
47 if(err == KErrNotFound) |
|
48 { |
|
49 err = ilibStateAdaptation.Load(KRefStateAdaptationPlugin); |
|
50 } |
|
51 User::LeaveIfError(err); |
|
52 stateAdaptationPlugin = (MStateAdaptation *)(ilibStateAdaptation.Lookup(1)()); |
|
53 if(stateAdaptationPlugin == NULL) |
|
54 { |
|
55 User::Leave(KErrNotFound); |
|
56 } |
|
57 return stateAdaptationPlugin; |
|
58 } |
|
59 |
|
60 MSimAdaptation* CSusAdaptationPluginLoader::CreateSimAdaptationL() |
|
61 { |
|
62 __ASSERT_DEBUG( KNullHandle == ilibSimAdaptation.Handle(), User::Panic(KPanicSsmSus, ELibraryAlreadyOpen)); |
|
63 MSimAdaptation* simAdaptationPlugin = NULL; |
|
64 TInt err = ilibSimAdaptation.Load(KSimAdaptationPlugin); |
|
65 |
|
66 // if licensees have not provided the Sim Adaptation Plugin, we try to load the reference |
|
67 // Sim Adaptation Plugin provided by Symbian |
|
68 if(err == KErrNotFound) |
|
69 { |
|
70 err = ilibSimAdaptation.Load(KRefSimAdaptationPlugin); |
|
71 } |
|
72 User::LeaveIfError(err); |
|
73 simAdaptationPlugin = (MSimAdaptation *)(ilibSimAdaptation.Lookup(1)()); |
|
74 if(simAdaptationPlugin == NULL) |
|
75 { |
|
76 User::Leave(KErrNotFound); |
|
77 } |
|
78 return simAdaptationPlugin; |
|
79 } |
|
80 |
|
81 MMiscAdaptation* CSusAdaptationPluginLoader::CreateMiscAdaptationL() |
|
82 { |
|
83 __ASSERT_DEBUG( KNullHandle == ilibMiscAdaptation.Handle(), User::Panic(KPanicSsmSus, ELibraryAlreadyOpen)); |
|
84 MMiscAdaptation* miscAdaptationPlugin = NULL; |
|
85 TInt err = ilibMiscAdaptation.Load(KMiscAdaptationPlugin); |
|
86 |
|
87 // if licensees have not provided the Misc Adaptation Plugin, we try to load the reference |
|
88 // Misc Adaptation Plugin provided by Symbian |
|
89 if(err == KErrNotFound) |
|
90 { |
|
91 err = ilibMiscAdaptation.Load(KRefMiscAdaptationPlugin); |
|
92 } |
|
93 User::LeaveIfError(err); |
|
94 miscAdaptationPlugin =(MMiscAdaptation *)(ilibMiscAdaptation.Lookup(1)()); |
|
95 if(miscAdaptationPlugin == NULL) |
|
96 { |
|
97 User::Leave(KErrNotFound); |
|
98 } |
|
99 return miscAdaptationPlugin; |
|
100 } |
|
101 |
|
102 MRtcAdaptation* CSusAdaptationPluginLoader::CreateRtcAdaptationL() |
|
103 { |
|
104 __ASSERT_DEBUG( KNullHandle == ilibRtcAdaptation.Handle(), User::Panic(KPanicSsmSus, ELibraryAlreadyOpen)); |
|
105 MRtcAdaptation* rtcAdaptationPlugin = NULL; |
|
106 TInt err = ilibRtcAdaptation.Load(KRtcAdaptationPlugin); |
|
107 |
|
108 // if licensees have not provided the Rtc Adaptation Plugin, we try to load the reference |
|
109 // Rtc Adaptation Plugin provided by Symbian |
|
110 if(err == KErrNotFound) |
|
111 { |
|
112 err = ilibRtcAdaptation.Load(KRefRtcAdaptationPlugin); |
|
113 } |
|
114 User::LeaveIfError(err); |
|
115 rtcAdaptationPlugin = (MRtcAdaptation *)(ilibRtcAdaptation.Lookup(1)()); |
|
116 if (rtcAdaptationPlugin == NULL) |
|
117 { |
|
118 User::Leave(KErrNotFound); |
|
119 } |
|
120 return rtcAdaptationPlugin; |
|
121 } |
|
122 |
|
123 MEmergencyCallRfAdaptation* CSusAdaptationPluginLoader::CreateEmergencyCallRfAdaptationL() |
|
124 { |
|
125 __ASSERT_DEBUG( KNullHandle == ilibEmergencyCallRfAdaptation.Handle(), User::Panic(KPanicSsmSus, ELibraryAlreadyOpen)); |
|
126 MEmergencyCallRfAdaptation* emergencyCallRfAdaptationPlugin = NULL; |
|
127 TInt err = ilibEmergencyCallRfAdaptation.Load(KEmergencyCallRfAdaptationPlugin); |
|
128 |
|
129 // if licensees have not provided the EmergencyCallRf Adaptation Plugin, we try to load the reference |
|
130 // EmergencyCallRf Adaptation Plugin provided by Symbian |
|
131 if(err == KErrNotFound) |
|
132 { |
|
133 err = ilibEmergencyCallRfAdaptation.Load(KRefEmergencyCallRfAdaptationPlugin); |
|
134 } |
|
135 User::LeaveIfError(err); |
|
136 emergencyCallRfAdaptationPlugin = (MEmergencyCallRfAdaptation *)(ilibEmergencyCallRfAdaptation.Lookup(1)()); |
|
137 if (emergencyCallRfAdaptationPlugin == NULL) |
|
138 { |
|
139 User::Leave(KErrNotFound); |
|
140 } |
|
141 return emergencyCallRfAdaptationPlugin; |
|
142 } |