|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: The source file of the CHsContentControlEComListener class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <ecom/ecom.h> |
|
20 |
|
21 // User includes |
|
22 #include "hscontentcontrolecomlistener.h" |
|
23 #include "hscontentcontrolecomobserver.h" |
|
24 |
|
25 // --------------------------------------------------------- |
|
26 // CHsContentControlEComListener::NewL |
|
27 // --------------------------------------------------------- |
|
28 // |
|
29 CHsContentControlEComListener* CHsContentControlEComListener::NewL( |
|
30 MHsContentControlEComObserver& aContentControlEComObserver ) |
|
31 { |
|
32 CHsContentControlEComListener* self = |
|
33 new ( ELeave ) CHsContentControlEComListener( |
|
34 aContentControlEComObserver ); |
|
35 CleanupStack::PushL( self ); |
|
36 self->ConstructL(); |
|
37 CleanupStack::Pop(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CHsContentControlEComListener::~CHsContentControlEComListener |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 CHsContentControlEComListener::~CHsContentControlEComListener() |
|
46 { |
|
47 Cancel(); // Cancel any request, if outstanding |
|
48 if( iEComSession ) |
|
49 { |
|
50 // Close session to ECom server |
|
51 iEComSession->Close(); |
|
52 } |
|
53 |
|
54 // Free up resources held by the EComSession. |
|
55 REComSession::FinalClose(); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------- |
|
59 // CHsContentControlEComListener::CHsContentControlEComListener |
|
60 // --------------------------------------------------------- |
|
61 // |
|
62 CHsContentControlEComListener::CHsContentControlEComListener( |
|
63 MHsContentControlEComObserver& aContentControlEComObserver ) |
|
64 : CActive( CActive::EPriorityStandard ), |
|
65 iHsContentControlEComObserver( aContentControlEComObserver ) |
|
66 { |
|
67 } |
|
68 |
|
69 // --------------------------------------------------------- |
|
70 // CHsContentControlEComListener::ConstructL |
|
71 // rest of the details are commented in the header |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 void CHsContentControlEComListener::ConstructL() |
|
75 { |
|
76 // Connect to the ECOM session server. |
|
77 iEComSession = &REComSession::OpenL(); |
|
78 |
|
79 // Queue the active object in the scheduler |
|
80 CActiveScheduler::Add( this ); |
|
81 |
|
82 // Start the active object and listen for changes in the ECOM registry. |
|
83 iEComSession->NotifyOnChange( iStatus ); |
|
84 SetActive(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CHsContentControlEComListener::RunL |
|
89 // rest of the details are commented in the header |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 void CHsContentControlEComListener::RunL() |
|
93 { |
|
94 if ( &iHsContentControlEComObserver && |
|
95 KErrNone == iStatus.Int() ) |
|
96 { |
|
97 // Notify observer |
|
98 iHsContentControlEComObserver.HandleEComChangeEvent(); |
|
99 } |
|
100 |
|
101 // Keep listening changes |
|
102 iEComSession->NotifyOnChange( iStatus ); |
|
103 |
|
104 // Restart the active Object |
|
105 SetActive(); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // CHsContentControlEComListener::DoCancel |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 void CHsContentControlEComListener::DoCancel() |
|
113 { |
|
114 // Cancel any outstanding requests. |
|
115 iEComSession->CancelNotifyOnChange( iStatus ); |
|
116 } |
|
117 |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // CHsContentControlEComListener::RunError |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 TInt CHsContentControlEComListener::RunError( TInt /*aError*/ ) |
|
124 { |
|
125 return KErrNone; |
|
126 } |
|
127 |
|
128 // End of file |