72 /** |
48 /** |
73 Deletes and frees memory allocated. |
49 Deletes and frees memory allocated. |
74 */ |
50 */ |
75 void CRtcAdaptationRef::Release() |
51 void CRtcAdaptationRef::Release() |
76 { |
52 { |
77 if(!IsTestPsKeyDefined()) |
53 delete this; |
78 { |
|
79 DEBUGPRINT1A("Release:: Calling Actual plugins functions (saartcadaptation.dll)"); |
|
80 iSaaRtcAdaptationDll->Release(); |
|
81 } |
|
82 delete this; |
|
83 } |
54 } |
84 |
55 |
85 /** |
56 /** |
86 Check that the RTC is valid. |
57 Check that the RTC is valid. |
87 Reference implementation completes the request with KErrNotSupported. This is required for automated testing. |
58 Reference implementation completes the request with KErrNotSupported as support for RTC is not available on Techview/H4 hrp. |
88 Actual plugins return expected values and this can be verified by manual testing |
59 |
89 |
|
90 @param aValidityPckg on return contains the status of the validity of the RTC as a boolean value |
60 @param aValidityPckg on return contains the status of the validity of the RTC as a boolean value |
91 @param aStatus to complete when the operation has finished |
61 @param aStatus to complete when the operation has finished |
92 |
62 |
93 @see TRequestStatus |
63 @see TRequestStatus |
94 */ |
64 */ |
95 void CRtcAdaptationRef::ValidateRtc(TDes8& aValidityPckg, TRequestStatus& aStatus) |
65 void CRtcAdaptationRef::ValidateRtc(TDes8& /*aValidityPckg*/, TRequestStatus& aStatus) |
96 { |
66 { |
97 if(!IsTestPsKeyDefined()) |
67 aStatus = KRequestPending; |
98 { |
68 TRequestStatus* status = &aStatus; |
99 DEBUGPRINT1A("ValidateRtc:: Calling Actual plugins functions (saartcadaptation.dll)"); |
69 User::RequestComplete(status, KErrNotSupported); |
100 iSaaRtcAdaptationDll->ValidateRtc(aValidityPckg, aStatus); |
|
101 } |
|
102 else |
|
103 { |
|
104 DEBUGPRINT1A("ValidateRtc:: Calling ref plugins functions (rtcadaptationref.dll)"); |
|
105 aStatus = KRequestPending; |
|
106 TRequestStatus* status = &aStatus; |
|
107 User::RequestComplete(status, KErrNotSupported); |
|
108 } |
|
109 } |
70 } |
110 |
71 |
111 /** |
72 /** |
112 Set a device wake-up alarm time, in UTC (coordinated universal time), in the RTC. |
73 Set a device wake-up alarm time, in UTC (coordinated universal time), in the RTC. |
113 Reference implementation completes the request with KErrNotSupported. This is required for automated testing. |
74 Reference implementation completes the request with KErrNotSupported as support for RTC is not available on Techview/H4 hrp. |
114 Actual plugins return expected values and this can be verified by manual testing |
|
115 For testing purposes it sets a pub sub property defined in test code. |
75 For testing purposes it sets a pub sub property defined in test code. |
116 |
76 |
117 @param aAlarmTimePckg requested wake up time |
77 @param aAlarmTimePckg requested wake up time |
118 @param aStatus to complete when the operation has finished |
78 @param aStatus to complete when the operation has finished |
119 |
79 |
120 @see TRequestStatus |
80 @see TRequestStatus |
121 */ |
81 */ |
122 void CRtcAdaptationRef::SetWakeupAlarm(TDesC8& aAlarmTimePckg, TRequestStatus& aStatus) |
82 void CRtcAdaptationRef::SetWakeupAlarm(TDesC8& aAlarmTimePckg, TRequestStatus& aStatus) |
123 { |
83 { |
124 if(!IsTestPsKeyDefined()) |
84 // Set this pub sub property (for testing purposes) |
125 { |
85 // The property is defined in the test code. In normal operation this will fail silently because the property has not been defined. |
126 DEBUGPRINT1A("SetWakeupAlarm:: Calling Actual plugins functions (saartcadaptation.dll)"); |
86 RProperty::Set(KAlarmServerUID, KTestRTCValueKey, aAlarmTimePckg); |
127 iSaaRtcAdaptationDll->SetWakeupAlarm(aAlarmTimePckg, aStatus); |
87 |
128 } |
88 aStatus = KRequestPending; |
129 else |
89 TRequestStatus* status = &aStatus; |
130 { |
90 // No support for RTC on HRP/Techview. |
131 DEBUGPRINT1A("SetWakeupAlarm:: Calling ref plugins functions (rtcadaptationref.dll)"); |
91 User::RequestComplete(status, KErrNotSupported); |
132 // Set this pub sub property (for testing purposes) |
|
133 // The property is defined in the test code. In normal operation this will fail silently because the property has not been defined. |
|
134 RProperty::Set(KAlarmServerUID, KTestRTCValueKey, aAlarmTimePckg); |
|
135 aStatus = KRequestPending; |
|
136 TRequestStatus* status = &aStatus; |
|
137 // No support for RTC on HRP/Techview. |
|
138 User::RequestComplete(status, KErrNotSupported); |
|
139 } |
|
140 } |
92 } |
141 |
|
142 |
93 |
143 /** |
94 /** |
144 Delete the current device wake-up alarm time in the RTC. |
95 Delete the current device wake-up alarm time in the RTC. |
145 Reference implementation completes the request with KErrNotSupported. This is required for automated testing. |
96 Reference implementation completes the request with KErrNotSupported as support for RTC is not available on Techview/H4 hrp. |
146 Actual plugins return expected values and this can be verified by manual testing |
|
147 For testing purposes it sets a pub sub property to a NULL value defined in test code. |
97 For testing purposes it sets a pub sub property to a NULL value defined in test code. |
148 |
98 |
149 @param aStatus to complete when the operation has finished |
99 @param aStatus to complete when the operation has finished |
150 |
100 |
151 @see TRequestStatus |
101 @see TRequestStatus |
152 */ |
102 */ |
153 void CRtcAdaptationRef::UnsetWakeupAlarm(TRequestStatus& aStatus) |
103 void CRtcAdaptationRef::UnsetWakeupAlarm(TRequestStatus& aStatus) |
154 { |
104 { |
155 if(!IsTestPsKeyDefined()) |
105 // Set this pub sub property to a NULL value because we are unsetting the RTC (for testing purposes) |
156 { |
106 // The property is defined in the test code. In normal operation this will fail silently because the property has not been defined. |
157 DEBUGPRINT1A("UnsetWakeupAlarm:: Calling Actual plugins functions (saartcadaptation.dll)"); |
107 TTime nullTime(Time::NullTTime()); |
158 iSaaRtcAdaptationDll->UnsetWakeupAlarm(aStatus); |
108 TPckgC<TTime> wakeupAlarmTimePckg(nullTime); |
159 } |
109 RProperty::Set(KAlarmServerUID, KTestRTCValueKey, wakeupAlarmTimePckg); |
160 else |
110 |
161 { |
111 aStatus = KRequestPending; |
162 DEBUGPRINT1A("UnsetWakeupAlarm:: Calling ref plugins functions (rtcadaptationref.dll)"); |
112 TRequestStatus* status = &aStatus; |
163 // Set this pub sub property to a NULL value because we are unsetting the RTC (for testing purposes) |
113 // No support for RTC on HRP/Techview. |
164 // The property is defined in the test code. In normal operation this will fail silently because the property has not been defined. |
114 User::RequestComplete(status, KErrNotSupported); |
165 TTime nullTime(Time::NullTTime()); |
|
166 TPckgC<TTime> wakeupAlarmTimePckg(nullTime); |
|
167 RProperty::Set(KAlarmServerUID, KTestRTCValueKey, wakeupAlarmTimePckg); |
|
168 aStatus = KRequestPending; |
|
169 TRequestStatus* status = &aStatus; |
|
170 // No support for RTC on HRP/Techview. |
|
171 User::RequestComplete(status, KErrNotSupported); |
|
172 } |
|
173 } |
115 } |
174 |
116 |
175 /** |
117 /** |
176 Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to Cancel. |
118 Cancel the outstanding request. Reference implementation completes the requests immediately so there is nothing to Cancel. |
177 On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled. |
119 On a device, Cancel() needs an implementation as the Request might be outstanding and it needs to be cancelled. |
178 */ |
120 */ |
179 void CRtcAdaptationRef::Cancel() |
121 void CRtcAdaptationRef::Cancel() |
180 { |
122 { |
181 if(!IsTestPsKeyDefined()) |
|
182 { |
|
183 DEBUGPRINT1A("Cancel:: Calling Actual plugins functions (saartcadaptation.dll)"); |
|
184 iSaaRtcAdaptationDll->Cancel(); |
|
185 } |
|
186 } |
123 } |
187 |
|
188 /** |
|
189 Helper function to check for P&S Key |
|
190 */ |
|
191 TBool CRtcAdaptationRef::IsTestPsKeyDefined() |
|
192 { |
|
193 TBool testPsKeyDefined = EFalse; |
|
194 TInt result = RProperty::Get(KPropertyCategory, KRtcAdaptationPluginPropertyKey, testPsKeyDefined); |
|
195 DEBUGPRINT3(_L("KRtcAdaptationPluginPropertyKey %d Error %d"), testPsKeyDefined, result); |
|
196 if ((KErrNone != result) && (KErrNotFound != result)) |
|
197 { |
|
198 //Could not retrieve property value. Tests might fail |
|
199 DEBUGPRINT1A("IsTestPsKeyDefined ERROR :: Could not retrieve property value)"); |
|
200 } |
|
201 return testPsKeyDefined; |
|
202 } |
|