|
1 // Copyright (c) 2004-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This contains CTestTimewSetAlarm |
|
15 // |
|
16 // |
|
17 |
|
18 #include <TestExecuteClient.h> |
|
19 |
|
20 #include "TestTimewSetAlarm.h" |
|
21 |
|
22 |
|
23 _LIT(KHour, "hour"); |
|
24 _LIT(KMinute,"minute"); |
|
25 _LIT(KMessage,"message"); |
|
26 _LIT(KBells,"bells"); |
|
27 |
|
28 |
|
29 // constructor |
|
30 CTestTimewSetAlarm::CTestTimewSetAlarm() |
|
31 { |
|
32 SetTestStepName(_L("SetAlarm")); |
|
33 } |
|
34 |
|
35 // destructor |
|
36 CTestTimewSetAlarm::~CTestTimewSetAlarm() |
|
37 { |
|
38 } |
|
39 |
|
40 // Each test step must supply a implementation for doTestStepL |
|
41 enum TVerdict CTestTimewSetAlarm::doTestStepL( void ) |
|
42 { |
|
43 // Printing to the console and log file |
|
44 INFO_PRINTF1(_L("TEST-> SETTING AN ALARM")); |
|
45 TRAPD(r, SetAlarmL()); |
|
46 |
|
47 if (r!=KErrNone) |
|
48 SetTestStepResult(EFail); |
|
49 |
|
50 // test steps return a result |
|
51 return TestStepResult(); |
|
52 } |
|
53 |
|
54 void CTestTimewSetAlarm::SetAlarmL( void ) |
|
55 { |
|
56 TInt hour; |
|
57 TInt minute; |
|
58 TPtrC ptrMessage; |
|
59 |
|
60 TTime alarmTime; |
|
61 alarmTime.HomeTime(); |
|
62 |
|
63 if ( !GetIntFromConfig(ConfigSection(), KHour(), hour) ) |
|
64 hour=alarmTime.DateTime().Hour(); |
|
65 |
|
66 if ( !GetIntFromConfig(ConfigSection(), KMinute(), minute) ) |
|
67 minute=0; |
|
68 |
|
69 GetStringFromConfig(ConfigSection(), KMessage(), ptrMessage); |
|
70 |
|
71 |
|
72 TDateTime dateTime=alarmTime.DateTime(); |
|
73 dateTime.SetHour(hour); |
|
74 dateTime.SetMinute(minute); |
|
75 dateTime.SetSecond(0); |
|
76 dateTime.SetMicroSecond(0); |
|
77 iAlarmData.NextDueTime()=dateTime; |
|
78 iAlarmData.RepeatDefinition()=(TAlarmRepeatDefinition)EAlarmRepeatDefintionRepeatNext24Hours; |
|
79 iAlarmData.Message() = ptrMessage; |
|
80 iAlarmData.SoundName()=KBells(); |
|
81 iModel = CAlmModel::NewL(NULL,KPriorityAlarmResponder); |
|
82 Model()->ClockAlarmSet(0,iAlarmData); |
|
83 delete iModel; |
|
84 } |