8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: This adaptation plugin implementation is for test/reference purposes. |
|
14 // The loading of this plugin is controlled through test macro defined in the iby file "ssmcompatibility.iby". |
|
15 // If the macro "TEST_SSM_MACRO" is not defined, original plugins are loaded and this plugin is not loaded. |
|
16 // If the test P & S key is set in the test code, the calls are routed to the reference or dummy implementations. |
|
17 // Else the actual plugins are loaded and the calls are routed to the actual implementations. |
|
18 // The test P & S key which it looks for is KEmergencyCallRfAdaptationPluginPropertyKey(0x2000E657) |
14 // |
19 // |
15 |
20 |
|
21 #include "ssmdebug.h" |
|
22 #include <e32property.h> |
16 #include "emergencycallrfadaptationref.h" |
23 #include "emergencycallrfadaptationref.h" |
|
24 |
|
25 const TUint32 KEmergencyCallRfAdaptationPluginPropertyKey = 0x2000E657; |
|
26 const TUid KPropertyCategory={0x2000D75B}; |
17 |
27 |
18 /** |
28 /** |
19 Function to create new Emergency Call RF Adaptation Plugin. |
29 Function to create new Emergency Call RF Adaptation Plugin. |
20 |
30 |
21 @return new instance of MEmergencyCallRfAdaptation for Emergency Call RF Adaptations. |
31 @return new instance of MEmergencyCallRfAdaptation for Emergency Call RF Adaptations. |
30 } |
40 } |
31 |
41 |
32 CEmergencyCallRfAdaptationRef* CEmergencyCallRfAdaptationRef::NewL() |
42 CEmergencyCallRfAdaptationRef* CEmergencyCallRfAdaptationRef::NewL() |
33 { |
43 { |
34 CEmergencyCallRfAdaptationRef* self = new(ELeave) CEmergencyCallRfAdaptationRef; |
44 CEmergencyCallRfAdaptationRef* self = new(ELeave) CEmergencyCallRfAdaptationRef; |
|
45 |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(); |
|
48 CleanupStack::Pop(); |
|
49 |
35 return self; |
50 return self; |
36 } |
51 } |
37 |
52 |
|
53 void CEmergencyCallRfAdaptationRef::ConstructL() |
|
54 { |
|
55 DEBUGPRINT1A("Loading Actual plugins"); |
|
56 _LIT(KSaaEmergencyCallRfAdaptationDLL, "saaemergencycallrfadaptation.dll"); |
|
57 User::LeaveIfError(iSaaEmergencyCallRfAdaptationLib.Load(KSaaEmergencyCallRfAdaptationDLL)); |
|
58 iSaaEmergencyCallRfAdaptationDll = (MEmergencyCallRfAdaptation *)(iSaaEmergencyCallRfAdaptationLib.Lookup(1)()); |
|
59 } |
|
60 |
38 CEmergencyCallRfAdaptationRef::~CEmergencyCallRfAdaptationRef() |
61 CEmergencyCallRfAdaptationRef::~CEmergencyCallRfAdaptationRef() |
39 { |
62 { |
|
63 iSaaEmergencyCallRfAdaptationLib.Close(); |
40 } |
64 } |
41 |
65 |
42 CEmergencyCallRfAdaptationRef::CEmergencyCallRfAdaptationRef() |
66 CEmergencyCallRfAdaptationRef::CEmergencyCallRfAdaptationRef() |
43 { |
67 { |
44 } |
68 } |
46 /** |
70 /** |
47 Deletes and frees memory allocated. |
71 Deletes and frees memory allocated. |
48 */ |
72 */ |
49 void CEmergencyCallRfAdaptationRef::Release() |
73 void CEmergencyCallRfAdaptationRef::Release() |
50 { |
74 { |
51 delete this; |
75 if(!IsTestPsKeyDefined()) |
|
76 { |
|
77 DEBUGPRINT1A("Release:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)"); |
|
78 iSaaEmergencyCallRfAdaptationDll->Release(); |
|
79 } |
|
80 else |
|
81 { |
|
82 DEBUGPRINT1A("Release:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)"); |
|
83 } |
|
84 delete this; |
52 } |
85 } |
53 |
86 |
54 /** |
87 /** |
55 Request RF activation so that an emergency call can be made. |
88 Request RF activation so that an emergency call can be made. |
56 Reference implementation completes the request with KErrNone as support for RF activation is not available on Techview/H4 hrp. |
89 Reference implementation completes the request with KErrNone. This is required for automated testing. |
|
90 Actual plugins return expected values and this can be verified by manual testing |
57 |
91 |
58 @param aStatus to complete when the operation has finished |
92 @param aStatus to complete when the operation has finished |
59 @see TRequestStatus |
93 @see TRequestStatus |
60 */ |
94 */ |
61 void CEmergencyCallRfAdaptationRef::ActivateRfForEmergencyCall(TRequestStatus& aStatus) |
95 void CEmergencyCallRfAdaptationRef::ActivateRfForEmergencyCall(TRequestStatus& aStatus) |
62 { |
96 { |
63 aStatus = KRequestPending; |
97 if(!IsTestPsKeyDefined()) |
64 TRequestStatus* status = &aStatus; |
98 { |
65 User::RequestComplete(status, KErrNone); |
99 DEBUGPRINT1A("ActivateRfForEmergencyCall:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)"); |
|
100 iSaaEmergencyCallRfAdaptationDll->ActivateRfForEmergencyCall(aStatus); |
|
101 } |
|
102 else |
|
103 { |
|
104 DEBUGPRINT1A("ActivateRfForEmergencyCall:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)"); |
|
105 aStatus = KRequestPending; |
|
106 TRequestStatus* status = &aStatus; |
|
107 User::RequestComplete(status, KErrNone); |
|
108 } |
66 } |
109 } |
67 |
110 |
68 /** |
111 /** |
69 Request RF deactivation after an emergency call have been made. |
112 Request RF deactivation after an emergency call have been made. |
70 Reference implementation completes the request with KErrNone as support for RF deactivation is not available on Techview/H4 hrp. |
113 Reference implementation completes the request with KErrNone. This is required for automated testing. |
71 |
114 Actual plugins return expected values and this can be verified by manual testing |
|
115 |
72 @param aStatus to complete when the operation has finished |
116 @param aStatus to complete when the operation has finished |
73 @see TRequestStatus |
117 @see TRequestStatus |
74 */ |
118 */ |
75 void CEmergencyCallRfAdaptationRef::DeactivateRfForEmergencyCall(TRequestStatus& aStatus) |
119 void CEmergencyCallRfAdaptationRef::DeactivateRfForEmergencyCall(TRequestStatus& aStatus) |
76 { |
120 { |
77 aStatus = KRequestPending; |
121 if(!IsTestPsKeyDefined()) |
78 TRequestStatus* status = &aStatus; |
122 { |
79 User::RequestComplete(status, KErrNone); |
123 DEBUGPRINT1A("DeactivateRfForEmergencyCall:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)"); |
80 } |
124 iSaaEmergencyCallRfAdaptationDll->DeactivateRfForEmergencyCall(aStatus); |
|
125 } |
|
126 else |
|
127 { |
|
128 DEBUGPRINT1A("DeactivateRfForEmergencyCall:: Calling Reference plugins functions (emergencycallrfadaptationref.dll)"); |
|
129 aStatus = KRequestPending; |
|
130 TRequestStatus* status = &aStatus; |
|
131 User::RequestComplete(status, KErrNone); |
|
132 } |
|
133 } |
81 |
134 |
82 /** |
135 /** |
83 Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to cancel. |
136 Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to cancel. |
84 On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled. |
137 On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled. |
85 */ |
138 */ |
86 void CEmergencyCallRfAdaptationRef::Cancel() |
139 void CEmergencyCallRfAdaptationRef::Cancel() |
87 { |
140 { |
|
141 if(!IsTestPsKeyDefined()) |
|
142 { |
|
143 DEBUGPRINT1A("Cancel:: Calling Actual plugins functions (saaemergencycallrfadaptation.dll)"); |
|
144 iSaaEmergencyCallRfAdaptationDll->Cancel(); |
|
145 } |
88 } |
146 } |
|
147 |
|
148 /** |
|
149 Helper function to check for P&S Key |
|
150 */ |
|
151 TBool CEmergencyCallRfAdaptationRef::IsTestPsKeyDefined() |
|
152 { |
|
153 TBool testPsKeyDefined = EFalse; |
|
154 TInt result = RProperty::Get(KPropertyCategory, KEmergencyCallRfAdaptationPluginPropertyKey, testPsKeyDefined); |
|
155 DEBUGPRINT3(_L("KEmergencyCallRfAdaptationPluginPropertyKey %d Error %d"), testPsKeyDefined, result); |
|
156 if ((KErrNone != result) && (KErrNotFound != result)) |
|
157 { |
|
158 //Could not retrieve property value. Tests might fail |
|
159 DEBUGPRINT1A("IsTestPsKeyDefined ERROR :: Could not retrieve property value)"); |
|
160 } |
|
161 return testPsKeyDefined; |
|
162 } |
|
163 |