23 AlarmListener::AlarmListener(AlarmClient* client, RASCliSession& session) |
23 AlarmListener::AlarmListener(AlarmClient* client, RASCliSession& session) |
24 :CActive(EPriorityStandard), |
24 :CActive(EPriorityStandard), |
25 mClient(client), |
25 mClient(client), |
26 mSession(session) |
26 mSession(session) |
27 { |
27 { |
28 qDebug("clock: AlarmListener::AlarmListener -->"); |
28 // Nothing to do. |
29 |
|
30 // Nothing to do. |
|
31 |
|
32 qDebug("clock: AlarmListener::AlarmListener <--"); |
|
33 } |
29 } |
34 |
30 |
35 AlarmListener::~AlarmListener() |
31 AlarmListener::~AlarmListener() |
36 { |
32 { |
37 qDebug("clock: AlarmListener::~AlarmListener -->"); |
|
38 |
|
39 if (IsActive()) { |
33 if (IsActive()) { |
40 Cancel(); |
34 Cancel(); |
41 } |
35 } |
42 |
36 |
43 qDebug("clock: AlarmListener::~AlarmListener <--"); |
|
44 } |
37 } |
45 |
38 |
46 void AlarmListener::start() |
39 void AlarmListener::start() |
47 { |
40 { |
48 qDebug("clock: AlarmListener::start -->"); |
|
49 |
|
50 // Add the AO to the scheduler. |
41 // Add the AO to the scheduler. |
51 CActiveScheduler::Add(this); |
42 CActiveScheduler::Add(this); |
52 |
43 |
53 // Subscrive for async notification from alarm server. |
44 // Subscrive for async notification from alarm server. |
54 mSession.NotifyChange(iStatus, mAlarmId); |
45 mSession.NotifyChange(iStatus, mAlarmId); |
55 |
46 |
56 qDebug("clock: AlarmListener::start - Successfully subscribed for change notifiation."); |
|
57 |
|
58 // Set the AO active. |
47 // Set the AO active. |
59 SetActive(); |
48 SetActive(); |
60 |
49 |
61 qDebug("clock: AlarmListener::start <--"); |
|
62 } |
50 } |
63 |
51 |
64 void AlarmListener::stop() |
52 void AlarmListener::stop() |
65 { |
53 { |
66 qDebug("clock: AlarmListener::stop -->"); |
|
67 |
|
68 if (IsActive()) { |
54 if (IsActive()) { |
69 Cancel(); |
55 Cancel(); |
70 } |
56 } |
71 |
|
72 qDebug("clock: AlarmListener::stop <--"); |
|
73 } |
57 } |
74 |
58 |
75 void AlarmListener::RunL() |
59 void AlarmListener::RunL() |
76 { |
60 { |
77 qDebug("clock: AlarmListener::RunL --"); |
|
78 |
|
79 if (iStatus != KRequestPending) { |
61 if (iStatus != KRequestPending) { |
80 // We get notification for various changes with the alarm server. |
62 // We get notification for various changes with the alarm server. |
81 // Only the required Events are used to emit a signal. |
63 // Only the required Events are used to emit a signal. |
82 if (iStatus == EAlarmChangeEventAlarmDeletion |
64 if (iStatus == EAlarmChangeEventAlarmDeletion |
83 || iStatus == EAlarmChangeEventTimerExpired |
65 || iStatus == EAlarmChangeEventTimerExpired |
93 iStatus = KRequestPending; |
75 iStatus = KRequestPending; |
94 mSession.NotifyChange(iStatus, mAlarmId); |
76 mSession.NotifyChange(iStatus, mAlarmId); |
95 |
77 |
96 SetActive(); |
78 SetActive(); |
97 } |
79 } |
98 |
|
99 qDebug("clock: AlarmListener::RunL <--"); |
|
100 } |
80 } |
101 |
81 |
102 void AlarmListener::DoCancel() |
82 void AlarmListener::DoCancel() |
103 { |
83 { |
104 qDebug("clock: AlarmListener::DoCancel -->"); |
|
105 |
|
106 // Cancel async request. |
84 // Cancel async request. |
107 mSession.NotifyChangeCancel(); |
85 mSession.NotifyChangeCancel(); |
108 |
86 |
109 qDebug("clock: AlarmListener::DoCancel <--"); |
|
110 } |
87 } |
111 |
88 |
112 // End of file |
89 // End of file |